@signalcore/ui 0.1.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (611) hide show
  1. package/README.md +896 -513
  2. package/dist/AgentAbout.d.ts +186 -0
  3. package/dist/AgentAbout.js +1020 -0
  4. package/dist/AgentAbout.js.map +1 -0
  5. package/dist/AgentCard.d.ts +49 -0
  6. package/dist/AgentCard.js +77 -0
  7. package/dist/AgentCard.js.map +1 -0
  8. package/dist/AgentChat.d.ts +233 -0
  9. package/dist/AgentChat.js +1127 -0
  10. package/dist/AgentChat.js.map +1 -0
  11. package/dist/AgentSpace.d.ts +112 -0
  12. package/dist/AgentSpace.js +339 -0
  13. package/dist/AgentSpace.js.map +1 -0
  14. package/dist/AgentTasks.d.ts +48 -0
  15. package/dist/AgentTasks.js +120 -0
  16. package/dist/AgentTasks.js.map +1 -0
  17. package/dist/BrowserView.d.ts +52 -0
  18. package/dist/BrowserView.js +328 -0
  19. package/dist/BrowserView.js.map +1 -0
  20. package/dist/FileView.d.ts +63 -0
  21. package/dist/FileView.js +449 -0
  22. package/dist/FileView.js.map +1 -0
  23. package/dist/Modes.d.ts +13 -0
  24. package/dist/Modes.js +75 -0
  25. package/dist/Modes.js.map +1 -0
  26. package/dist/VoiceCall.d.ts +91 -0
  27. package/dist/VoiceCall.js +302 -0
  28. package/dist/VoiceCall.js.map +1 -0
  29. package/dist/about.d.ts +212 -0
  30. package/dist/about.js +136 -0
  31. package/dist/about.js.map +1 -0
  32. package/dist/agentIcons.d.ts +33 -0
  33. package/dist/agentIcons.js +36 -0
  34. package/dist/agentIcons.js.map +1 -0
  35. package/dist/automation/Automation.d.ts +35 -0
  36. package/dist/automation/Automation.js +268 -0
  37. package/dist/automation/Automation.js.map +1 -0
  38. package/dist/automation/RunView.d.ts +25 -0
  39. package/dist/automation/RunView.js +187 -0
  40. package/dist/automation/RunView.js.map +1 -0
  41. package/dist/automation/cron.d.ts +41 -0
  42. package/dist/automation/cron.js +169 -0
  43. package/dist/automation/cron.js.map +1 -0
  44. package/dist/automation/marks.js +121 -0
  45. package/dist/automation/marks.js.map +1 -0
  46. package/dist/automation/messages.d.ts +113 -0
  47. package/dist/automation/messages.js +113 -0
  48. package/dist/automation/messages.js.map +1 -0
  49. package/dist/automation/record.d.ts +47 -0
  50. package/dist/automation/record.js +177 -0
  51. package/dist/automation/record.js.map +1 -0
  52. package/dist/automation/types.d.ts +143 -0
  53. package/dist/automation/when.d.ts +36 -0
  54. package/dist/automation/when.js +168 -0
  55. package/dist/automation/when.js.map +1 -0
  56. package/dist/blocks.d.ts +185 -0
  57. package/dist/browser.js +292 -0
  58. package/dist/browser.js.map +1 -0
  59. package/dist/call.d.ts +89 -0
  60. package/dist/call.js +218 -0
  61. package/dist/call.js.map +1 -0
  62. package/dist/channelParts.js +26 -0
  63. package/dist/channelParts.js.map +1 -0
  64. package/dist/classes.js +8 -3
  65. package/dist/classes.js.map +1 -0
  66. package/dist/client.d.ts +146 -54
  67. package/dist/client.js +204 -1
  68. package/dist/client.js.map +1 -0
  69. package/dist/conversationFiles.js +46 -0
  70. package/dist/conversationFiles.js.map +1 -0
  71. package/dist/credentials.d.ts +45 -0
  72. package/dist/credentials.js +98 -0
  73. package/dist/credentials.js.map +1 -0
  74. package/dist/dev.js +17 -0
  75. package/dist/dev.js.map +1 -0
  76. package/dist/es.d.ts +17 -0
  77. package/dist/es.js +382 -0
  78. package/dist/es.js.map +1 -0
  79. package/dist/files.d.ts +21 -0
  80. package/dist/files.js +214 -0
  81. package/dist/files.js.map +1 -0
  82. package/dist/frames.d.ts +115 -0
  83. package/dist/frames.js +219 -0
  84. package/dist/frames.js.map +1 -0
  85. package/dist/icons.js +29 -0
  86. package/dist/icons.js.map +1 -0
  87. package/dist/index.d.ts +63 -60
  88. package/dist/index.js +59 -45
  89. package/dist/kit/AudioPlayer.d.ts +20 -0
  90. package/dist/kit/AudioPlayer.js +116 -0
  91. package/dist/kit/AudioPlayer.js.map +1 -0
  92. package/dist/kit/Button.d.ts +29 -0
  93. package/dist/kit/Button.js +59 -0
  94. package/dist/kit/Button.js.map +1 -0
  95. package/dist/kit/Card.d.ts +16 -0
  96. package/dist/kit/Card.js +36 -0
  97. package/dist/kit/Card.js.map +1 -0
  98. package/dist/kit/Chart.js +152 -0
  99. package/dist/kit/Chart.js.map +1 -0
  100. package/dist/kit/Choices.d.ts +21 -0
  101. package/dist/kit/Choices.js +99 -0
  102. package/dist/kit/Choices.js.map +1 -0
  103. package/dist/kit/Combobox.d.ts +26 -0
  104. package/dist/kit/Combobox.js +190 -0
  105. package/dist/kit/Combobox.js.map +1 -0
  106. package/dist/kit/DateField.d.ts +17 -0
  107. package/dist/kit/DateField.js +133 -0
  108. package/dist/kit/DateField.js.map +1 -0
  109. package/dist/kit/Field.d.ts +40 -0
  110. package/dist/kit/Field.js +98 -0
  111. package/dist/kit/Field.js.map +1 -0
  112. package/dist/kit/FileField.d.ts +113 -0
  113. package/dist/kit/FileField.js +341 -0
  114. package/dist/kit/FileField.js.map +1 -0
  115. package/dist/kit/FileMark.d.ts +15 -0
  116. package/dist/kit/FileMark.js +39 -0
  117. package/dist/kit/FileMark.js.map +1 -0
  118. package/dist/kit/Inputs.d.ts +59 -0
  119. package/dist/kit/Inputs.js +205 -0
  120. package/dist/kit/Inputs.js.map +1 -0
  121. package/dist/kit/List.d.ts +47 -0
  122. package/dist/kit/List.js +85 -0
  123. package/dist/kit/List.js.map +1 -0
  124. package/dist/kit/Mark.d.ts +30 -0
  125. package/dist/kit/Mark.js +27 -0
  126. package/dist/kit/Mark.js.map +1 -0
  127. package/dist/kit/MarkStack.d.ts +15 -0
  128. package/dist/kit/MarkStack.js +26 -0
  129. package/dist/kit/MarkStack.js.map +1 -0
  130. package/dist/kit/Note.d.ts +11 -0
  131. package/dist/kit/Note.js +31 -0
  132. package/dist/kit/Note.js.map +1 -0
  133. package/dist/kit/Popover.js +90 -0
  134. package/dist/kit/Popover.js.map +1 -0
  135. package/dist/kit/RangeField.d.ts +14 -0
  136. package/dist/kit/RangeField.js +47 -0
  137. package/dist/kit/RangeField.js.map +1 -0
  138. package/dist/kit/RatingField.d.ts +14 -0
  139. package/dist/kit/RatingField.js +50 -0
  140. package/dist/kit/RatingField.js.map +1 -0
  141. package/dist/kit/Stat.d.ts +26 -0
  142. package/dist/kit/Stat.js +46 -0
  143. package/dist/kit/Stat.js.map +1 -0
  144. package/dist/kit/Switch.d.ts +14 -0
  145. package/dist/kit/Switch.js +21 -0
  146. package/dist/kit/Switch.js.map +1 -0
  147. package/dist/kit/Tag.d.ts +16 -0
  148. package/dist/kit/Tag.js +20 -0
  149. package/dist/kit/Tag.js.map +1 -0
  150. package/dist/kit/Tile.d.ts +34 -0
  151. package/dist/kit/Tile.js +52 -0
  152. package/dist/kit/Tile.js.map +1 -0
  153. package/dist/kit/TimeField.d.ts +31 -0
  154. package/dist/kit/TimeField.js +109 -0
  155. package/dist/kit/TimeField.js.map +1 -0
  156. package/dist/kit/context.d.ts +22 -0
  157. package/dist/kit/context.js +46 -0
  158. package/dist/kit/context.js.map +1 -0
  159. package/dist/kit/dates.d.ts +14 -0
  160. package/dist/kit/dates.js +129 -0
  161. package/dist/kit/dates.js.map +1 -0
  162. package/dist/kit/messages.d.ts +99 -0
  163. package/dist/kit/messages.js +66 -0
  164. package/dist/kit/messages.js.map +1 -0
  165. package/dist/kit/numbers.d.ts +12 -0
  166. package/dist/kit/numbers.js +40 -0
  167. package/dist/kit/numbers.js.map +1 -0
  168. package/dist/kit/options.d.ts +10 -0
  169. package/dist/kit/options.js +23 -0
  170. package/dist/kit/options.js.map +1 -0
  171. package/dist/kit/uploads.d.ts +42 -0
  172. package/dist/kit/uploads.js +165 -0
  173. package/dist/kit/uploads.js.map +1 -0
  174. package/dist/kit/waveform.js +76 -0
  175. package/dist/kit/waveform.js.map +1 -0
  176. package/dist/locale.d.ts +1 -0
  177. package/dist/locale.js +1 -0
  178. package/dist/markdown.js +84 -0
  179. package/dist/markdown.js.map +1 -0
  180. package/dist/marks.js +217 -0
  181. package/dist/marks.js.map +1 -0
  182. package/dist/reveal.js +48 -0
  183. package/dist/reveal.js.map +1 -0
  184. package/dist/stepGlyphs.js +62 -0
  185. package/dist/stepGlyphs.js.map +1 -0
  186. package/dist/surface/Form.js +264 -0
  187. package/dist/surface/Form.js.map +1 -0
  188. package/dist/surface/Markdown.js +42 -0
  189. package/dist/surface/Markdown.js.map +1 -0
  190. package/dist/surface/Surface.d.ts +31 -17
  191. package/dist/surface/Surface.js +480 -57
  192. package/dist/surface/Surface.js.map +1 -0
  193. package/dist/surface/scope.d.ts +32 -0
  194. package/dist/surface/scope.js +23 -0
  195. package/dist/surface/scope.js.map +1 -0
  196. package/dist/surface/values.d.ts +44 -0
  197. package/dist/surface/values.js +237 -0
  198. package/dist/surface/values.js.map +1 -0
  199. package/dist/tint.d.ts +10 -0
  200. package/dist/tint.js +19 -0
  201. package/dist/tint.js.map +1 -0
  202. package/dist/types.d.ts +541 -0
  203. package/dist/types.js +16 -0
  204. package/dist/types.js.map +1 -0
  205. package/dist/useAgentFace.d.ts +18 -0
  206. package/dist/useAgentFace.js +45 -0
  207. package/dist/useAgentFace.js.map +1 -0
  208. package/dist/useCall.d.ts +39 -0
  209. package/dist/useCall.js +273 -0
  210. package/dist/useCall.js.map +1 -0
  211. package/dist/useConversation.d.ts +77 -0
  212. package/dist/useConversation.js +523 -0
  213. package/dist/useConversation.js.map +1 -0
  214. package/dist/useDictation.d.ts +17 -0
  215. package/dist/useDictation.js +68 -0
  216. package/dist/useDictation.js.map +1 -0
  217. package/dist/useLive.d.ts +26 -0
  218. package/dist/useLive.js +88 -0
  219. package/dist/useLive.js.map +1 -0
  220. package/dist/usePolled.js +68 -0
  221. package/dist/usePolled.js.map +1 -0
  222. package/dist/voice/Orb.d.ts +10 -9
  223. package/dist/voice/Orb.js +43 -39
  224. package/dist/voice/Orb.js.map +1 -0
  225. package/dist/voice/StillOrb.js +33 -0
  226. package/dist/voice/StillOrb.js.map +1 -0
  227. package/dist/voice/WebGLOrb.js +98 -0
  228. package/dist/voice/WebGLOrb.js.map +1 -0
  229. package/dist/voice/fluidDots.js +161 -0
  230. package/dist/voice/fluidDots.js.map +1 -0
  231. package/dist/voice/motion.js +84 -0
  232. package/dist/voice/motion.js.map +1 -0
  233. package/dist/voice/orbs.d.ts +32 -0
  234. package/dist/voice/orbs.js +16 -0
  235. package/dist/voice/orbs.js.map +1 -0
  236. package/dist/voice/useReducedMotion.js +16 -16
  237. package/dist/voice/useReducedMotion.js.map +1 -0
  238. package/dist/voice/wave.js +116 -0
  239. package/dist/voice/wave.js.map +1 -0
  240. package/dist/voice/webgl.js +177 -0
  241. package/dist/voice/webgl.js.map +1 -0
  242. package/dist/widget.js +284 -8
  243. package/package.json +49 -39
  244. package/src/AgentAbout.tsx +1621 -0
  245. package/src/AgentCard.tsx +123 -0
  246. package/src/AgentChat.tsx +1812 -0
  247. package/src/AgentSpace.tsx +540 -0
  248. package/src/AgentTasks.tsx +163 -0
  249. package/src/BrowserView.tsx +442 -0
  250. package/src/FileView.tsx +620 -0
  251. package/src/Modes.tsx +112 -0
  252. package/src/VoiceCall.tsx +411 -0
  253. package/src/about.ts +355 -0
  254. package/src/agentIcons.ts +56 -0
  255. package/src/automation/Automation.tsx +308 -0
  256. package/src/automation/RunView.tsx +213 -0
  257. package/src/automation/cron.ts +196 -0
  258. package/src/automation/marks.tsx +144 -0
  259. package/src/automation/messages.ts +231 -0
  260. package/src/automation/record.ts +206 -0
  261. package/src/automation/types.ts +146 -0
  262. package/src/automation/when.ts +195 -0
  263. package/src/blocks.ts +249 -0
  264. package/src/browser.ts +334 -0
  265. package/src/call.ts +300 -0
  266. package/src/channelParts.ts +17 -0
  267. package/src/classes.ts +10 -0
  268. package/src/client.ts +397 -0
  269. package/src/conversationFiles.ts +54 -0
  270. package/src/credentials.ts +158 -0
  271. package/src/dev.ts +20 -0
  272. package/src/es.ts +423 -0
  273. package/src/files.ts +238 -0
  274. package/src/frames.ts +291 -0
  275. package/src/icons.tsx +49 -0
  276. package/src/index.ts +271 -0
  277. package/src/kit/AudioPlayer.tsx +129 -0
  278. package/src/kit/Button.tsx +97 -0
  279. package/src/kit/Card.tsx +47 -0
  280. package/src/kit/Chart.tsx +129 -0
  281. package/src/kit/Choices.tsx +131 -0
  282. package/src/kit/Combobox.tsx +247 -0
  283. package/src/kit/DateField.tsx +156 -0
  284. package/src/kit/Field.tsx +137 -0
  285. package/src/kit/FileField.tsx +492 -0
  286. package/src/kit/FileMark.tsx +56 -0
  287. package/src/kit/Inputs.tsx +250 -0
  288. package/src/kit/List.tsx +135 -0
  289. package/src/kit/Mark.tsx +64 -0
  290. package/src/kit/MarkStack.tsx +29 -0
  291. package/src/kit/Note.tsx +42 -0
  292. package/src/kit/Popover.tsx +121 -0
  293. package/src/kit/RangeField.tsx +53 -0
  294. package/src/kit/RatingField.tsx +62 -0
  295. package/src/kit/Stat.tsx +60 -0
  296. package/src/kit/Switch.tsx +28 -0
  297. package/src/kit/Tag.tsx +32 -0
  298. package/src/kit/Tile.tsx +74 -0
  299. package/src/kit/TimeField.tsx +157 -0
  300. package/src/kit/context.tsx +246 -0
  301. package/src/kit/dates.ts +150 -0
  302. package/src/kit/messages.ts +160 -0
  303. package/src/kit/numbers.ts +44 -0
  304. package/src/kit/options.ts +30 -0
  305. package/src/kit/uploads.ts +244 -0
  306. package/src/kit/waveform.ts +84 -0
  307. package/src/locale.ts +6 -0
  308. package/src/markdown.ts +69 -0
  309. package/src/marks.tsx +328 -0
  310. package/src/reveal.ts +52 -0
  311. package/src/stepGlyphs.ts +83 -0
  312. package/src/styles.css +6970 -0
  313. package/src/surface/Form.tsx +299 -0
  314. package/src/surface/Markdown.tsx +55 -0
  315. package/src/surface/Surface.tsx +605 -0
  316. package/src/surface/scope.ts +82 -0
  317. package/src/surface/values.ts +361 -0
  318. package/src/tint.ts +14 -0
  319. package/src/types.ts +604 -0
  320. package/src/useAgentFace.ts +47 -0
  321. package/src/useCall.ts +292 -0
  322. package/src/useConversation.ts +627 -0
  323. package/src/useDictation.ts +83 -0
  324. package/src/useLive.ts +115 -0
  325. package/src/usePolled.ts +60 -0
  326. package/src/voice/Orb.tsx +45 -0
  327. package/src/voice/StillOrb.tsx +29 -0
  328. package/src/voice/WebGLOrb.tsx +98 -0
  329. package/src/voice/fluidDots.tsx +171 -0
  330. package/src/voice/motion.ts +112 -0
  331. package/src/voice/orbs.ts +39 -0
  332. package/src/voice/useReducedMotion.ts +24 -0
  333. package/src/voice/wave.tsx +129 -0
  334. package/src/voice/webgl.ts +209 -0
  335. package/src/widget/css.d.ts +5 -0
  336. package/src/widget/element.tsx +535 -0
  337. package/src/widget/index.ts +10 -0
  338. package/src/widget/mount.ts +27 -0
  339. package/src/widget/widget.css +253 -0
  340. package/dist/SignalcoreProvider.d.ts +0 -113
  341. package/dist/SignalcoreProvider.js +0 -84
  342. package/dist/automations/AppMarks.d.ts +0 -11
  343. package/dist/automations/AppMarks.js +0 -18
  344. package/dist/automations/AutomationCard.d.ts +0 -27
  345. package/dist/automations/AutomationCard.js +0 -53
  346. package/dist/automations/AutomationsWindow.d.ts +0 -38
  347. package/dist/automations/AutomationsWindow.js +0 -57
  348. package/dist/automations/Card.d.ts +0 -46
  349. package/dist/automations/Card.js +0 -45
  350. package/dist/automations/ScheduleMarks.d.ts +0 -13
  351. package/dist/automations/ScheduleMarks.js +0 -24
  352. package/dist/automations/presentationIcons.d.ts +0 -7
  353. package/dist/automations/presentationIcons.js +0 -67
  354. package/dist/automations/schedule.d.ts +0 -25
  355. package/dist/automations/schedule.js +0 -59
  356. package/dist/automations/time.d.ts +0 -3
  357. package/dist/automations/time.js +0 -25
  358. package/dist/browser/BrowserView.d.ts +0 -43
  359. package/dist/browser/BrowserView.js +0 -94
  360. package/dist/browser/room.d.ts +0 -21
  361. package/dist/browser/room.js +0 -33
  362. package/dist/browser/useBrowserSession.d.ts +0 -17
  363. package/dist/browser/useBrowserSession.js +0 -67
  364. package/dist/builder/BuilderChat.d.ts +0 -32
  365. package/dist/builder/BuilderChat.js +0 -41
  366. package/dist/builder/BuilderTranscript.d.ts +0 -49
  367. package/dist/builder/BuilderTranscript.js +0 -62
  368. package/dist/builder/StatusLine.d.ts +0 -8
  369. package/dist/builder/StatusLine.js +0 -17
  370. package/dist/builder/answer.d.ts +0 -7
  371. package/dist/builder/answer.js +0 -8
  372. package/dist/builder/blocks.d.ts +0 -31
  373. package/dist/builder/blocks.js +0 -74
  374. package/dist/builder/items.d.ts +0 -15
  375. package/dist/builder/items.js +0 -21
  376. package/dist/builder/steps.d.ts +0 -20
  377. package/dist/builder/steps.js +0 -120
  378. package/dist/builder/time.d.ts +0 -4
  379. package/dist/builder/time.js +0 -24
  380. package/dist/builder/useBuildSession.d.ts +0 -36
  381. package/dist/builder/useBuildSession.js +0 -130
  382. package/dist/builder/workingOn.d.ts +0 -7
  383. package/dist/builder/workingOn.js +0 -15
  384. package/dist/chat/AgentChat.d.ts +0 -37
  385. package/dist/chat/AgentChat.js +0 -21
  386. package/dist/chat/ChatView.d.ts +0 -25
  387. package/dist/chat/ChatView.js +0 -34
  388. package/dist/chat/Composer.d.ts +0 -20
  389. package/dist/chat/Composer.js +0 -22
  390. package/dist/chat/MessageRow.d.ts +0 -22
  391. package/dist/chat/MessageRow.js +0 -32
  392. package/dist/chat/arrival.d.ts +0 -15
  393. package/dist/chat/arrival.js +0 -25
  394. package/dist/chat/history.d.ts +0 -24
  395. package/dist/chat/history.js +0 -45
  396. package/dist/chat/moments.d.ts +0 -25
  397. package/dist/chat/moments.js +0 -72
  398. package/dist/chat/types.d.ts +0 -12
  399. package/dist/chat/types.js +0 -1
  400. package/dist/chat/useComposer.d.ts +0 -46
  401. package/dist/chat/useComposer.js +0 -62
  402. package/dist/chat/useConversation.d.ts +0 -35
  403. package/dist/chat/useConversation.js +0 -71
  404. package/dist/chat/useStickToBottom.d.ts +0 -9
  405. package/dist/chat/useStickToBottom.js +0 -33
  406. package/dist/chat/useTurns.d.ts +0 -49
  407. package/dist/chat/useTurns.js +0 -111
  408. package/dist/classes.d.ts +0 -2
  409. package/dist/development.d.ts +0 -5
  410. package/dist/development.js +0 -8
  411. package/dist/flow/FlowWindow.d.ts +0 -42
  412. package/dist/flow/FlowWindow.js +0 -126
  413. package/dist/flow/index.d.ts +0 -16
  414. package/dist/flow/index.js +0 -16
  415. package/dist/flow/kinds.d.ts +0 -23
  416. package/dist/flow/kinds.js +0 -48
  417. package/dist/flow/map.d.ts +0 -44
  418. package/dist/flow/map.js +0 -225
  419. package/dist/flow/nodePaths.d.ts +0 -7
  420. package/dist/flow/nodePaths.js +0 -17
  421. package/dist/flow/relations.d.ts +0 -42
  422. package/dist/flow/relations.js +0 -174
  423. package/dist/host.d.ts +0 -124
  424. package/dist/host.js +0 -1
  425. package/dist/live/LiveView.d.ts +0 -28
  426. package/dist/live/LiveView.js +0 -55
  427. package/dist/live/capture.d.ts +0 -20
  428. package/dist/live/capture.js +0 -100
  429. package/dist/live/follow.d.ts +0 -26
  430. package/dist/live/follow.js +0 -72
  431. package/dist/live/paint.d.ts +0 -13
  432. package/dist/live/paint.js +0 -77
  433. package/dist/live/useLiveStream.d.ts +0 -16
  434. package/dist/live/useLiveStream.js +0 -57
  435. package/dist/look.d.ts +0 -33
  436. package/dist/look.js +0 -241
  437. package/dist/messages/en.d.ts +0 -3
  438. package/dist/messages/en.js +0 -251
  439. package/dist/messages/es.d.ts +0 -3
  440. package/dist/messages/es.js +0 -251
  441. package/dist/messages/index.d.ts +0 -16
  442. package/dist/messages/index.js +0 -33
  443. package/dist/messages/types.d.ts +0 -246
  444. package/dist/messages/types.js +0 -1
  445. package/dist/parts/Button.d.ts +0 -18
  446. package/dist/parts/Button.js +0 -17
  447. package/dist/parts/Icon.d.ts +0 -39
  448. package/dist/parts/Icon.js +0 -37
  449. package/dist/parts/Input.d.ts +0 -6
  450. package/dist/parts/Input.js +0 -11
  451. package/dist/parts/Spinner.d.ts +0 -2
  452. package/dist/parts/Spinner.js +0 -7
  453. package/dist/patterns.d.ts +0 -15
  454. package/dist/patterns.js +0 -5
  455. package/dist/presets.d.ts +0 -82
  456. package/dist/presets.js +0 -81
  457. package/dist/primitives.d.ts +0 -22
  458. package/dist/primitives.js +0 -58
  459. package/dist/request/RequestCard.d.ts +0 -34
  460. package/dist/request/RequestCard.js +0 -101
  461. package/dist/request/approval/ApprovalPreview.d.ts +0 -5
  462. package/dist/request/approval/ApprovalPreview.js +0 -27
  463. package/dist/request/approval/shapes.d.ts +0 -32
  464. package/dist/request/approval/shapes.js +0 -68
  465. package/dist/request/apps.d.ts +0 -11
  466. package/dist/request/apps.js +0 -27
  467. package/dist/request/cards.d.ts +0 -12
  468. package/dist/request/cards.js +0 -24
  469. package/dist/request/deliver.d.ts +0 -12
  470. package/dist/request/deliver.js +0 -21
  471. package/dist/request/handOver.d.ts +0 -18
  472. package/dist/request/handOver.js +0 -33
  473. package/dist/request/kinds/Approval.d.ts +0 -3
  474. package/dist/request/kinds/Approval.js +0 -9
  475. package/dist/request/kinds/Choice.d.ts +0 -3
  476. package/dist/request/kinds/Choice.js +0 -8
  477. package/dist/request/kinds/Connect.d.ts +0 -9
  478. package/dist/request/kinds/Connect.js +0 -119
  479. package/dist/request/kinds/FreeText.d.ts +0 -3
  480. package/dist/request/kinds/FreeText.js +0 -20
  481. package/dist/request/kinds/HandOver.d.ts +0 -13
  482. package/dist/request/kinds/HandOver.js +0 -20
  483. package/dist/request/kinds/Secret.d.ts +0 -7
  484. package/dist/request/kinds/Secret.js +0 -49
  485. package/dist/request/kinds/Upload.d.ts +0 -6
  486. package/dist/request/kinds/Upload.js +0 -47
  487. package/dist/request/types.d.ts +0 -83
  488. package/dist/request/types.js +0 -1
  489. package/dist/safeUrl.d.ts +0 -6
  490. package/dist/safeUrl.js +0 -8
  491. package/dist/stream/builder.d.ts +0 -176
  492. package/dist/stream/builder.js +0 -202
  493. package/dist/stream/reduce.d.ts +0 -51
  494. package/dist/stream/reduce.js +0 -58
  495. package/dist/stream/untilAborted.d.ts +0 -7
  496. package/dist/stream/untilAborted.js +0 -32
  497. package/dist/stream/useRunStream.d.ts +0 -26
  498. package/dist/stream/useRunStream.js +0 -137
  499. package/dist/styles.css +0 -2318
  500. package/dist/surface/HostNode.d.ts +0 -14
  501. package/dist/surface/HostNode.js +0 -30
  502. package/dist/surface/Node.d.ts +0 -7
  503. package/dist/surface/Node.js +0 -49
  504. package/dist/surface/SurfaceBoundary.d.ts +0 -26
  505. package/dist/surface/SurfaceBoundary.js +0 -20
  506. package/dist/surface/bindings.d.ts +0 -14
  507. package/dist/surface/bindings.js +0 -37
  508. package/dist/surface/check.d.ts +0 -27
  509. package/dist/surface/check.js +0 -102
  510. package/dist/surface/format.d.ts +0 -10
  511. package/dist/surface/format.js +0 -32
  512. package/dist/surface/hosts.d.ts +0 -6
  513. package/dist/surface/hosts.js +0 -11
  514. package/dist/surface/scene.d.ts +0 -21
  515. package/dist/surface/scene.js +0 -8
  516. package/dist/surface/templates/Browser.d.ts +0 -6
  517. package/dist/surface/templates/Browser.js +0 -11
  518. package/dist/surface/templates/Chart.d.ts +0 -6
  519. package/dist/surface/templates/Chart.js +0 -13
  520. package/dist/surface/templates/Choices.d.ts +0 -3
  521. package/dist/surface/templates/Choices.js +0 -12
  522. package/dist/surface/templates/Form.d.ts +0 -3
  523. package/dist/surface/templates/Form.js +0 -44
  524. package/dist/surface/templates/KeyValue.d.ts +0 -3
  525. package/dist/surface/templates/KeyValue.js +0 -7
  526. package/dist/surface/templates/Layout.d.ts +0 -5
  527. package/dist/surface/templates/Layout.js +0 -16
  528. package/dist/surface/templates/Live.d.ts +0 -6
  529. package/dist/surface/templates/Live.js +0 -9
  530. package/dist/surface/templates/Media.d.ts +0 -5
  531. package/dist/surface/templates/Media.js +0 -13
  532. package/dist/surface/templates/Slots.d.ts +0 -3
  533. package/dist/surface/templates/Slots.js +0 -19
  534. package/dist/surface/templates/Table.d.ts +0 -3
  535. package/dist/surface/templates/Table.js +0 -12
  536. package/dist/surface/templates/Text.d.ts +0 -4
  537. package/dist/surface/templates/Text.js +0 -15
  538. package/dist/surface/templates/index.d.ts +0 -7
  539. package/dist/surface/templates/index.js +0 -32
  540. package/dist/surface/types.d.ts +0 -68
  541. package/dist/surface/types.js +0 -6
  542. package/dist/theme.d.ts +0 -62
  543. package/dist/theme.js +0 -9
  544. package/dist/useTokens.d.ts +0 -7
  545. package/dist/useTokens.js +0 -41
  546. package/dist/voice/VoiceWindow.d.ts +0 -18
  547. package/dist/voice/VoiceWindow.js +0 -35
  548. package/dist/voice/index.d.ts +0 -13
  549. package/dist/voice/index.js +0 -12
  550. package/dist/voice/meter.d.ts +0 -16
  551. package/dist/voice/meter.js +0 -52
  552. package/dist/voice/orbColors.d.ts +0 -16
  553. package/dist/voice/orbColors.js +0 -75
  554. package/dist/voice/pushable.d.ts +0 -16
  555. package/dist/voice/pushable.js +0 -56
  556. package/dist/voice/useDictation.d.ts +0 -24
  557. package/dist/voice/useDictation.js +0 -60
  558. package/dist/voice/useReducedMotion.d.ts +0 -5
  559. package/dist/voice/useVoice.d.ts +0 -70
  560. package/dist/voice/useVoice.js +0 -197
  561. package/dist/voice/useVoicePrimitives.d.ts +0 -7
  562. package/dist/voice/useVoicePrimitives.js +0 -11
  563. package/dist/voice/voice.d.ts +0 -55
  564. package/dist/voice/voice.js +0 -9
  565. package/dist/voice/webSpeech.d.ts +0 -33
  566. package/dist/voice/webSpeech.js +0 -258
  567. package/dist/widget.js.map +0 -1
  568. package/dist/windows/AgentSpace.d.ts +0 -78
  569. package/dist/windows/AgentSpace.js +0 -135
  570. package/dist/windows/Captions.d.ts +0 -13
  571. package/dist/windows/Captions.js +0 -22
  572. package/dist/windows/Dock.d.ts +0 -37
  573. package/dist/windows/Dock.js +0 -22
  574. package/dist/windows/Journal.d.ts +0 -15
  575. package/dist/windows/Journal.js +0 -19
  576. package/dist/windows/KindMark.d.ts +0 -7
  577. package/dist/windows/KindMark.js +0 -31
  578. package/dist/windows/Pending.d.ts +0 -8
  579. package/dist/windows/Pending.js +0 -17
  580. package/dist/windows/Stage.d.ts +0 -18
  581. package/dist/windows/Stage.js +0 -21
  582. package/dist/windows/StatusLabel.d.ts +0 -9
  583. package/dist/windows/StatusLabel.js +0 -7
  584. package/dist/windows/Strip.d.ts +0 -17
  585. package/dist/windows/Strip.js +0 -42
  586. package/dist/windows/SurfaceWindow.d.ts +0 -20
  587. package/dist/windows/SurfaceWindow.js +0 -12
  588. package/dist/windows/WindowFrame.d.ts +0 -23
  589. package/dist/windows/WindowFrame.js +0 -22
  590. package/dist/windows/hearing.d.ts +0 -11
  591. package/dist/windows/hearing.js +0 -26
  592. package/dist/windows/kinds.d.ts +0 -47
  593. package/dist/windows/kinds.js +0 -28
  594. package/dist/windows/reduce.d.ts +0 -98
  595. package/dist/windows/reduce.js +0 -151
  596. package/dist/windows/registry.d.ts +0 -18
  597. package/dist/windows/registry.js +0 -61
  598. package/dist/windows/reveal.d.ts +0 -9
  599. package/dist/windows/reveal.js +0 -6
  600. package/dist/windows/space.d.ts +0 -21
  601. package/dist/windows/space.js +0 -6
  602. package/dist/windows/status.d.ts +0 -11
  603. package/dist/windows/status.js +0 -30
  604. package/dist/windows/types.d.ts +0 -15
  605. package/dist/windows/types.js +0 -1
  606. package/dist/windows/useLoaded.d.ts +0 -44
  607. package/dist/windows/useLoaded.js +0 -58
  608. package/dist/windows/useUnread.d.ts +0 -7
  609. package/dist/windows/useUnread.js +0 -21
  610. package/dist/windows/useWindows.d.ts +0 -70
  611. package/dist/windows/useWindows.js +0 -60
@@ -0,0 +1,161 @@
1
+ import { CUTOUT, INK, INK_UNIFORMS } from "./webgl.js";
2
+ import { WebGLOrb } from "./WebGLOrb.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ /** At rest the dots move at 0.4 of their pace; listening or speaking, at all of it. */
5
+ const FLUID_DOTS = {
6
+ fragment: `precision highp float;
7
+ uniform vec2 iResolution; uniform float iTime;
8
+ uniform float uLevel; // signalcore: the signal
9
+ ${INK_UNIFORMS}
10
+ const float TAU = 6.28318530718;
11
+ const int N = 6;
12
+ const float SMOOTH_K = 0.08;
13
+ const float INTENSITY = 0.0025;
14
+ const float FALLOFF_P = 1.35;
15
+ const float FADE_START = 0.02;
16
+ const float FADE_END = 0.56;
17
+ const float ABERR = 0.005;
18
+ const vec3 SPECTRAL = vec3(0.0, 0.5, 1.0) * ABERR;
19
+ const float HUE_SPEED = 0.06;
20
+ const float COLOR_K = 0.5;
21
+ const float SAT = 0.01;
22
+ const float HUE_SPAN = 0.667;
23
+ const float MERGE_PERIOD = 6.0;
24
+ const float T_MOVE = 1.25;
25
+ const float STAGGER = 0.33;
26
+ const float HOLD = 0.0;
27
+ const float W = 4.6;
28
+ const float L = 3.2;
29
+ const float PIERCE = 0.12;
30
+ const float RECOIL = 0.035;
31
+ const float REC_LAG = 0.11;
32
+ const float GATHER_PERIOD = 12.0;
33
+ const float GATHER_START = 9.2;
34
+ const float GATHER_HOLD = 0.8;
35
+ const float GATHER_R = 0.008;
36
+ const float GATHER_DIM = 0.85;
37
+ const float GATHER_IN = 1.8;
38
+ const float GATHER_IN_L = 7.5;
39
+ const float BURST_W = 6.5;
40
+ const float BURST_L = 4.0;
41
+ const float CHARGE_T = 0.30;
42
+ const float CHARGE_SHRK = 0.18;
43
+ const float CHARGE_GLOW = 0.35;
44
+ const float FLASH_GAIN = 1.2;
45
+ const float FLASH_DECAY = 7.0;
46
+
47
+ float hash11(float n){ return fract(sin(n*127.1 + 311.7)*43758.5453); }
48
+ float settleWL(float tau, float w, float l){
49
+ if(tau <= 0.0) return 0.0;
50
+ return 1.0 - exp(-l*tau)*cos(w*tau);
51
+ }
52
+ float settle(float tau){ return settleWL(tau, W, L); }
53
+ float settleCrit(float tau, float l){
54
+ if(tau <= 0.0) return 0.0;
55
+ return 1.0 - exp(-l*tau)*(1.0 + l*tau);
56
+ }
57
+ float smin(float a, float b, float k){
58
+ float h = max(k - abs(a - b), 0.0) / k;
59
+ return min(a, b) - h*h*k*0.25;
60
+ }
61
+ vec3 hue2rgb(float h){
62
+ h = fract(h);
63
+ float r = clamp(abs(h*6.0 - 3.0) - 1.0, 0.0, 1.0);
64
+ float g = clamp(2.0 - abs(h*6.0 - 2.0), 0.0, 1.0);
65
+ float b = clamp(2.0 - abs(h*6.0 - 4.0), 0.0, 1.0);
66
+ return vec3(r, g, b);
67
+ }
68
+ float dotR(float fi, float seed, float t){
69
+ return 0.036 + 0.010*sin(t*1.3 + seed*TAU) + 0.005*sin(t*2.4 + fi*1.3);
70
+ }
71
+ float dotSD(vec2 p, vec2 pos, float r, float t, float fi, float shapeDamp){
72
+ vec2 d = p - pos;
73
+ float sq = 0.075 * (0.5 + 0.5*sin(t*0.9 + fi*2.0)) * shapeDamp;
74
+ float ca = cos(t*0.35 + fi), sa = sin(t*0.35 + fi);
75
+ d = mat2(ca,-sa,sa,ca) * d;
76
+ d *= vec2(1.0+sq, 1.0-sq);
77
+ return length(d) - r;
78
+ }
79
+ vec3 scene(vec2 p, float t){
80
+ float k = floor(t/MERGE_PERIOD);
81
+ float u = fract(t/MERGE_PERIOD);
82
+ float te = u * MERGE_PERIOD;
83
+ float tg = mod(t, GATHER_PERIOD);
84
+ float g = settleCrit((tg - GATHER_START) * GATHER_IN, GATHER_IN_L)
85
+ - settleWL(tg - GATHER_START - GATHER_HOLD, BURST_W, BURST_L);
86
+ float gC = clamp(g, 0.0, 1.0);
87
+ float tb = tg - (GATHER_START + GATHER_HOLD);
88
+ float charge = smoothstep(-CHARGE_T, 0.0, min(tb, 0.0)) * gC;
89
+ float flash = tb > 0.0 ? exp(-tb * FLASH_DECAY) : 0.0;
90
+ float gBright = mix(1.0, GATHER_DIM, gC) * (1.0 + CHARGE_GLOW*charge + FLASH_GAIN*flash);
91
+ vec3 total3 = vec3(1e5);
92
+ vec3 cAcc = vec3(0.0);
93
+ float wAcc = 1e-6;
94
+ for(int i=0; i<N; i++){
95
+ float fi = float(i);
96
+ float seed = hash11(fi);
97
+ float ang = fi/float(N)*TAU + t*0.35;
98
+ vec2 dir = vec2(cos(ang), sin(ang));
99
+ float R = 0.17 + 0.010*sin(t*1.0) + 0.007*sin(t*1.3 + seed*TAU);
100
+ float pairId = mod(fi, 3.0);
101
+ float moverLow = mod(k + pairId, 2.0);
102
+ float isMover = (fi < 2.5) ? step(moverLow, 0.5) : step(0.5, moverLow);
103
+ float goStart = pairId * STAGGER;
104
+ float retStart = 3.0*STAGGER + HOLD + pairId * STAGGER;
105
+ float m = (settle(te - goStart) - settle(te - retStart)) * isMover;
106
+ float rec = (settle(te - goStart - REC_LAG) - settle(te - retStart - REC_LAG)) * (1.0 - isMover);
107
+ float rSelf = dotR(fi, seed, t);
108
+ rSelf = mix(rSelf, 0.036, gC);
109
+ rSelf *= 1.0 - CHARGE_SHRK * charge;
110
+ float fj = mod(fi + 3.0, 6.0);
111
+ float rPart = dotR(fj, hash11(fj), t);
112
+ float deep = -(R + RECOIL) - PIERCE * rPart;
113
+ float radial = mix(R, deep, m) + RECOIL * rec;
114
+ radial = mix(radial, GATHER_R, g);
115
+ vec2 pos = radial * dir;
116
+ float sdR = dotSD(p - SPECTRAL.r*dir, pos, rSelf, t, fi, 1.0 - gC);
117
+ float sdG = dotSD(p - SPECTRAL.g*dir, pos, rSelf, t, fi, 1.0 - gC);
118
+ float sdB = dotSD(p - SPECTRAL.b*dir, pos, rSelf, t, fi, 1.0 - gC);
119
+ total3 = vec3( smin(total3.r, sdR, SMOOTH_K),
120
+ smin(total3.g, sdG, SMOOTH_K),
121
+ smin(total3.b, sdB, SMOOTH_K) );
122
+ float hue = fract(fi/float(N) + t*HUE_SPEED) * HUE_SPAN;
123
+ vec3 dotCol = mix(vec3(1.0), hue2rgb(hue), SAT);
124
+ float w = exp(-sdG * COLOR_K);
125
+ cAcc += w * dotCol;
126
+ wAcc += w;
127
+ }
128
+ vec3 sd3 = max(total3, vec3(0.0)) + 1e-4;
129
+ vec3 core3 = clamp(INTENSITY / pow(sd3, vec3(FALLOFF_P)), 0.0, 1.0);
130
+ vec3 edge3 = 1.0 - smoothstep(vec3(FADE_START), vec3(FADE_END), sd3);
131
+ vec3 bright = core3 * edge3 * gBright;
132
+ return bright * (cAcc / wAcc);
133
+ }
134
+ void mainImage(out vec4 fragColor, in vec2 fragCoord){
135
+ vec2 res = iResolution.xy;
136
+ vec2 p = (2.0*fragCoord - res) / min(res.x, res.y);
137
+ float t = iTime;
138
+ p /= 1.0 + 0.03*sin(t*1.0);
139
+ vec3 col = scene(p, t);
140
+ col *= 1.0 + 0.05*sin(t*1.0 + 1.0);
141
+ col *= 0.7 + 0.3*clamp(uLevel, 0.0, 1.0); // signalcore: brighter with the voice
142
+ col = pow(col, vec3(1.0/1.2));
143
+ col = min(col, 1.0);
144
+ float n = fract(sin(dot(fragCoord, vec2(12.9898,78.233)))*43758.5453);
145
+ col += (n - 0.5)/255.0;
146
+ fragColor = vec4(col, 1.0);
147
+ }
148
+ void main(){ mainImage(gl_FragColor, gl_FragCoord.xy); ${INK} ${CUTOUT} }`,
149
+ pace: (energy) => .4 + .6 * energy
150
+ };
151
+ /** The `fluid-dots` style of the orb: six metaballs that merge, scatter and gather. */
152
+ function FluidDotsOrb(props) {
153
+ return /* @__PURE__ */ jsx(WebGLOrb, {
154
+ ...props,
155
+ shader: FLUID_DOTS
156
+ });
157
+ }
158
+ //#endregion
159
+ export { FLUID_DOTS, FluidDotsOrb as default };
160
+
161
+ //# sourceMappingURL=fluidDots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluidDots.js","names":[],"sources":["../../src/voice/fluidDots.tsx"],"sourcesContent":["import type { OrbProps } from \"./orbs\";\nimport { WebGLOrb } from \"./WebGLOrb\";\nimport { CUTOUT, INK, INK_UNIFORMS, type Shader } from \"./webgl\";\n\n/**\n * Ported from siri-wave by 40973894 (21st.dev), MIT. Shaders kept verbatim except the uniforms\n * added below.\n *\n * The `fluid-dots` style of the orb: six metaballs that merge, scatter and gather. Ours is\n * `uLevel`, how loud the microphone or the voice is, 0 to 1: the dots shine from 0.7 of their\n * brightness in silence to all of it at full voice. How fast they move follows the energy of\n * the state (0.4 of the original's pace at rest, all of it while listening and speaking, see\n * `pace`), summed on the clock the shader is given so that a change of state bends the motion.\n *\n * The last line of `main` is ours too: the host's colour, when it gives one (`INK`, its uniforms\n * `INK_UNIFORMS`), and what is near black turning transparent (`CUTOUT`).\n */\nconst FRAGMENT = `precision highp float;\nuniform vec2 iResolution; uniform float iTime;\nuniform float uLevel; // signalcore: the signal\n${INK_UNIFORMS}\nconst float TAU = 6.28318530718;\nconst int N = 6;\nconst float SMOOTH_K = 0.08;\nconst float INTENSITY = 0.0025;\nconst float FALLOFF_P = 1.35;\nconst float FADE_START = 0.02;\nconst float FADE_END = 0.56;\nconst float ABERR = 0.005;\nconst vec3 SPECTRAL = vec3(0.0, 0.5, 1.0) * ABERR;\nconst float HUE_SPEED = 0.06;\nconst float COLOR_K = 0.5;\nconst float SAT = 0.01;\nconst float HUE_SPAN = 0.667;\nconst float MERGE_PERIOD = 6.0;\nconst float T_MOVE = 1.25;\nconst float STAGGER = 0.33;\nconst float HOLD = 0.0;\nconst float W = 4.6;\nconst float L = 3.2;\nconst float PIERCE = 0.12;\nconst float RECOIL = 0.035;\nconst float REC_LAG = 0.11;\nconst float GATHER_PERIOD = 12.0;\nconst float GATHER_START = 9.2;\nconst float GATHER_HOLD = 0.8;\nconst float GATHER_R = 0.008;\nconst float GATHER_DIM = 0.85;\nconst float GATHER_IN = 1.8;\nconst float GATHER_IN_L = 7.5;\nconst float BURST_W = 6.5;\nconst float BURST_L = 4.0;\nconst float CHARGE_T = 0.30;\nconst float CHARGE_SHRK = 0.18;\nconst float CHARGE_GLOW = 0.35;\nconst float FLASH_GAIN = 1.2;\nconst float FLASH_DECAY = 7.0;\n\nfloat hash11(float n){ return fract(sin(n*127.1 + 311.7)*43758.5453); }\nfloat settleWL(float tau, float w, float l){\n if(tau <= 0.0) return 0.0;\n return 1.0 - exp(-l*tau)*cos(w*tau);\n}\nfloat settle(float tau){ return settleWL(tau, W, L); }\nfloat settleCrit(float tau, float l){\n if(tau <= 0.0) return 0.0;\n return 1.0 - exp(-l*tau)*(1.0 + l*tau);\n}\nfloat smin(float a, float b, float k){\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - h*h*k*0.25;\n}\nvec3 hue2rgb(float h){\n h = fract(h);\n float r = clamp(abs(h*6.0 - 3.0) - 1.0, 0.0, 1.0);\n float g = clamp(2.0 - abs(h*6.0 - 2.0), 0.0, 1.0);\n float b = clamp(2.0 - abs(h*6.0 - 4.0), 0.0, 1.0);\n return vec3(r, g, b);\n}\nfloat dotR(float fi, float seed, float t){\n return 0.036 + 0.010*sin(t*1.3 + seed*TAU) + 0.005*sin(t*2.4 + fi*1.3);\n}\nfloat dotSD(vec2 p, vec2 pos, float r, float t, float fi, float shapeDamp){\n vec2 d = p - pos;\n float sq = 0.075 * (0.5 + 0.5*sin(t*0.9 + fi*2.0)) * shapeDamp;\n float ca = cos(t*0.35 + fi), sa = sin(t*0.35 + fi);\n d = mat2(ca,-sa,sa,ca) * d;\n d *= vec2(1.0+sq, 1.0-sq);\n return length(d) - r;\n}\nvec3 scene(vec2 p, float t){\n float k = floor(t/MERGE_PERIOD);\n float u = fract(t/MERGE_PERIOD);\n float te = u * MERGE_PERIOD;\n float tg = mod(t, GATHER_PERIOD);\n float g = settleCrit((tg - GATHER_START) * GATHER_IN, GATHER_IN_L)\n - settleWL(tg - GATHER_START - GATHER_HOLD, BURST_W, BURST_L);\n float gC = clamp(g, 0.0, 1.0);\n float tb = tg - (GATHER_START + GATHER_HOLD);\n float charge = smoothstep(-CHARGE_T, 0.0, min(tb, 0.0)) * gC;\n float flash = tb > 0.0 ? exp(-tb * FLASH_DECAY) : 0.0;\n float gBright = mix(1.0, GATHER_DIM, gC) * (1.0 + CHARGE_GLOW*charge + FLASH_GAIN*flash);\n vec3 total3 = vec3(1e5);\n vec3 cAcc = vec3(0.0);\n float wAcc = 1e-6;\n for(int i=0; i<N; i++){\n float fi = float(i);\n float seed = hash11(fi);\n float ang = fi/float(N)*TAU + t*0.35;\n vec2 dir = vec2(cos(ang), sin(ang));\n float R = 0.17 + 0.010*sin(t*1.0) + 0.007*sin(t*1.3 + seed*TAU);\n float pairId = mod(fi, 3.0);\n float moverLow = mod(k + pairId, 2.0);\n float isMover = (fi < 2.5) ? step(moverLow, 0.5) : step(0.5, moverLow);\n float goStart = pairId * STAGGER;\n float retStart = 3.0*STAGGER + HOLD + pairId * STAGGER;\n float m = (settle(te - goStart) - settle(te - retStart)) * isMover;\n float rec = (settle(te - goStart - REC_LAG) - settle(te - retStart - REC_LAG)) * (1.0 - isMover);\n float rSelf = dotR(fi, seed, t);\n rSelf = mix(rSelf, 0.036, gC);\n rSelf *= 1.0 - CHARGE_SHRK * charge;\n float fj = mod(fi + 3.0, 6.0);\n float rPart = dotR(fj, hash11(fj), t);\n float deep = -(R + RECOIL) - PIERCE * rPart;\n float radial = mix(R, deep, m) + RECOIL * rec;\n radial = mix(radial, GATHER_R, g);\n vec2 pos = radial * dir;\n float sdR = dotSD(p - SPECTRAL.r*dir, pos, rSelf, t, fi, 1.0 - gC);\n float sdG = dotSD(p - SPECTRAL.g*dir, pos, rSelf, t, fi, 1.0 - gC);\n float sdB = dotSD(p - SPECTRAL.b*dir, pos, rSelf, t, fi, 1.0 - gC);\n total3 = vec3( smin(total3.r, sdR, SMOOTH_K),\n smin(total3.g, sdG, SMOOTH_K),\n smin(total3.b, sdB, SMOOTH_K) );\n float hue = fract(fi/float(N) + t*HUE_SPEED) * HUE_SPAN;\n vec3 dotCol = mix(vec3(1.0), hue2rgb(hue), SAT);\n float w = exp(-sdG * COLOR_K);\n cAcc += w * dotCol;\n wAcc += w;\n }\n vec3 sd3 = max(total3, vec3(0.0)) + 1e-4;\n vec3 core3 = clamp(INTENSITY / pow(sd3, vec3(FALLOFF_P)), 0.0, 1.0);\n vec3 edge3 = 1.0 - smoothstep(vec3(FADE_START), vec3(FADE_END), sd3);\n vec3 bright = core3 * edge3 * gBright;\n return bright * (cAcc / wAcc);\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord){\n vec2 res = iResolution.xy;\n vec2 p = (2.0*fragCoord - res) / min(res.x, res.y);\n float t = iTime;\n p /= 1.0 + 0.03*sin(t*1.0);\n vec3 col = scene(p, t);\n col *= 1.0 + 0.05*sin(t*1.0 + 1.0);\n col *= 0.7 + 0.3*clamp(uLevel, 0.0, 1.0); // signalcore: brighter with the voice\n col = pow(col, vec3(1.0/1.2));\n col = min(col, 1.0);\n float n = fract(sin(dot(fragCoord, vec2(12.9898,78.233)))*43758.5453);\n col += (n - 0.5)/255.0;\n fragColor = vec4(col, 1.0);\n}\nvoid main(){ mainImage(gl_FragColor, gl_FragCoord.xy); ${INK} ${CUTOUT} }`;\n\n/** At rest the dots move at 0.4 of their pace; listening or speaking, at all of it. */\nexport const FLUID_DOTS: Shader = {\n fragment: FRAGMENT,\n pace: (energy) => 0.4 + 0.6 * energy,\n};\n\n/** The `fluid-dots` style of the orb: six metaballs that merge, scatter and gather. */\nexport default function FluidDotsOrb(props: OrbProps) {\n return <WebGLOrb {...props} shader={FLUID_DOTS} />;\n}\n"],"mappings":";;;;AAkKA,MAAa,aAAqB;CAChC,UAAU;;;EA/IV,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDA2I0C,IAAI,GAAG,OAAO;CAKrE,OAAO,WAAW,KAAM,KAAM;AAChC;;AAGA,SAAwB,aAAa,OAAiB;CACpD,OAAO,oBAAC,UAAD;EAAU,GAAI;EAAO,QAAQ;CAAa,CAAA;AACnD"}
@@ -0,0 +1,84 @@
1
+ //#region src/voice/motion.ts
2
+ /** How long an orb at rest keeps moving before it stops asking the browser for frames. */
3
+ const IDLE_STOP_MS = 3e3;
4
+ /** The longest step of time one frame may take: a tab coming back does not make the orb jump. */
5
+ const LONGEST_STEP = .1;
6
+ /** How loud the still frame of a state that is not rest is drawn, so its shape still says it. */
7
+ const STILL_LEVEL = .45;
8
+ /** How much the shader is asked to be moved by the signal in each state. */
9
+ const ENERGY = {
10
+ idle: 0,
11
+ thinking: .5,
12
+ listening: 1,
13
+ speaking: 1
14
+ };
15
+ /** How fast the level and the energy move toward where they are going, per second. */
16
+ const LEVEL_RATE = 14;
17
+ const ENERGY_RATE = 3;
18
+ /** `from` moved toward `to` at `rate` per second: a value that does not jump. */
19
+ function approach(from, to, rate, step) {
20
+ return from + (to - from) * (1 - Math.exp(-rate * step));
21
+ }
22
+ /** The motion of an orb that appears in `state`, already as loud as `level`. */
23
+ function motionOf(state, level) {
24
+ return {
25
+ time: 1,
26
+ level,
27
+ energy: ENERGY[state],
28
+ last: 0
29
+ };
30
+ }
31
+ /** One frame of `state` at a fixed moment: what the orb shows under reduced motion, one per state. */
32
+ function drawStill(renderer, state) {
33
+ renderer.draw({
34
+ time: 1,
35
+ level: state === "idle" ? 0 : STILL_LEVEL,
36
+ energy: ENERGY[state]
37
+ });
38
+ }
39
+ /**
40
+ * Draws `state` frame by frame from `motion` on (which it moves), reading `level` on each frame.
41
+ * It asks for no frame while the tab is hidden, and stops three seconds after it came to rest
42
+ * (`idle`); the tab coming back asks again. The result stops it.
43
+ */
44
+ function animate(renderer, shader, state, level, motion) {
45
+ let frame = 0;
46
+ let restingSince = null;
47
+ const tick = (stamp) => {
48
+ frame = 0;
49
+ const step = Math.min(LONGEST_STEP, Math.max(0, (stamp - motion.last) / 1e3));
50
+ motion.last = stamp;
51
+ motion.level = approach(motion.level, level(), LEVEL_RATE, step);
52
+ motion.energy = approach(motion.energy, ENERGY[state], ENERGY_RATE, step);
53
+ motion.time += step * shader.pace(motion.energy);
54
+ renderer.draw({
55
+ time: motion.time,
56
+ level: motion.level,
57
+ energy: motion.energy
58
+ });
59
+ if (state === "idle") {
60
+ restingSince ??= stamp;
61
+ if (stamp - restingSince >= 3e3) return;
62
+ }
63
+ frame = requestAnimationFrame(tick);
64
+ };
65
+ const run = () => {
66
+ if (frame === 0 && !document.hidden) frame = requestAnimationFrame(tick);
67
+ };
68
+ const onVisibility = () => {
69
+ if (document.hidden) {
70
+ cancelAnimationFrame(frame);
71
+ frame = 0;
72
+ } else run();
73
+ };
74
+ document.addEventListener("visibilitychange", onVisibility);
75
+ run();
76
+ return () => {
77
+ document.removeEventListener("visibilitychange", onVisibility);
78
+ cancelAnimationFrame(frame);
79
+ };
80
+ }
81
+ //#endregion
82
+ export { ENERGY, IDLE_STOP_MS, STILL_LEVEL, animate, drawStill, motionOf };
83
+
84
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion.js","names":[],"sources":["../../src/voice/motion.ts"],"sourcesContent":["/**\n * How a shader orb moves: the level and the energy of its state eased toward where they are\n * going, its clock paced by the energy, a frame drawn each time the browser has one, and no frame\n * asked for when nothing moves. Nothing here knows React; `WebGLOrb` runs it.\n */\n\nimport type { OrbState } from \"./orbs\";\nimport type { Renderer, Shader } from \"./webgl\";\n\n/** How long an orb at rest keeps moving before it stops asking the browser for frames. */\nexport const IDLE_STOP_MS = 3000;\n\n/** The longest step of time one frame may take: a tab coming back does not make the orb jump. */\nconst LONGEST_STEP = 0.1;\n\n/** The moment a still frame is drawn at, and where a moving orb starts: a settled picture. */\nexport const STILL_TIME = 1.0;\n\n/** How loud the still frame of a state that is not rest is drawn, so its shape still says it. */\nexport const STILL_LEVEL = 0.45;\n\n/** How much the shader is asked to be moved by the signal in each state. */\nexport const ENERGY: Readonly<Record<OrbState, number>> = {\n idle: 0,\n thinking: 0.5,\n listening: 1,\n speaking: 1,\n};\n\n/** How fast the level and the energy move toward where they are going, per second. */\nconst LEVEL_RATE = 14;\nconst ENERGY_RATE = 3;\n\n/** `from` moved toward `to` at `rate` per second: a value that does not jump. */\nfunction approach(from: number, to: number, rate: number, step: number): number {\n return from + (to - from) * (1 - Math.exp(-rate * step));\n}\n\n/**\n * Where an orb's motion is: its clock, its eased level and energy, and the moment of its last\n * frame. One per orb, kept across its states, so a new state bends the motion instead of starting\n * it over.\n */\nexport interface Motion {\n time: number;\n level: number;\n energy: number;\n last: number;\n}\n\n/** The motion of an orb that appears in `state`, already as loud as `level`. */\nexport function motionOf(state: OrbState, level: number): Motion {\n return { time: STILL_TIME, level, energy: ENERGY[state], last: 0 };\n}\n\n/** One frame of `state` at a fixed moment: what the orb shows under reduced motion, one per state. */\nexport function drawStill(renderer: Renderer, state: OrbState): void {\n renderer.draw({\n time: STILL_TIME,\n level: state === \"idle\" ? 0 : STILL_LEVEL,\n energy: ENERGY[state],\n });\n}\n\n/**\n * Draws `state` frame by frame from `motion` on (which it moves), reading `level` on each frame.\n * It asks for no frame while the tab is hidden, and stops three seconds after it came to rest\n * (`idle`); the tab coming back asks again. The result stops it.\n */\nexport function animate(\n renderer: Renderer,\n shader: Shader,\n state: OrbState,\n level: () => number,\n motion: Motion,\n): () => void {\n let frame = 0;\n let restingSince: number | null = null;\n\n const tick = (stamp: number) => {\n frame = 0;\n const step = Math.min(LONGEST_STEP, Math.max(0, (stamp - motion.last) / 1000));\n motion.last = stamp;\n motion.level = approach(motion.level, level(), LEVEL_RATE, step);\n motion.energy = approach(motion.energy, ENERGY[state], ENERGY_RATE, step);\n motion.time += step * shader.pace(motion.energy);\n renderer.draw({ time: motion.time, level: motion.level, energy: motion.energy });\n if (state === \"idle\") {\n restingSince ??= stamp;\n if (stamp - restingSince >= IDLE_STOP_MS) return;\n }\n frame = requestAnimationFrame(tick);\n };\n const run = () => {\n if (frame === 0 && !document.hidden) frame = requestAnimationFrame(tick);\n };\n const onVisibility = () => {\n if (document.hidden) {\n cancelAnimationFrame(frame);\n frame = 0;\n } else {\n run();\n }\n };\n\n document.addEventListener(\"visibilitychange\", onVisibility);\n run();\n return () => {\n document.removeEventListener(\"visibilitychange\", onVisibility);\n cancelAnimationFrame(frame);\n };\n}\n"],"mappings":";;AAUA,MAAa,eAAe;;AAG5B,MAAM,eAAe;;AAMrB,MAAa,cAAc;;AAG3B,MAAa,SAA6C;CACxD,MAAM;CACN,UAAU;CACV,WAAW;CACX,UAAU;AACZ;;AAGA,MAAM,aAAa;AACnB,MAAM,cAAc;;AAGpB,SAAS,SAAS,MAAc,IAAY,MAAc,MAAsB;CAC9E,OAAO,QAAQ,KAAK,SAAS,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI;AACxD;;AAeA,SAAgB,SAAS,OAAiB,OAAuB;CAC/D,OAAO;EAAE,MAAA;EAAkB;EAAO,QAAQ,OAAO;EAAQ,MAAM;CAAE;AACnE;;AAGA,SAAgB,UAAU,UAAoB,OAAuB;CACnE,SAAS,KAAK;EACZ,MAAA;EACA,OAAO,UAAU,SAAS,IAAI;EAC9B,QAAQ,OAAO;CACjB,CAAC;AACH;;;;;;AAOA,SAAgB,QACd,UACA,QACA,OACA,OACA,QACY;CACZ,IAAI,QAAQ;CACZ,IAAI,eAA8B;CAElC,MAAM,QAAQ,UAAkB;EAC9B,QAAQ;EACR,MAAM,OAAO,KAAK,IAAI,cAAc,KAAK,IAAI,IAAI,QAAQ,OAAO,QAAQ,GAAI,CAAC;EAC7E,OAAO,OAAO;EACd,OAAO,QAAQ,SAAS,OAAO,OAAO,MAAM,GAAG,YAAY,IAAI;EAC/D,OAAO,SAAS,SAAS,OAAO,QAAQ,OAAO,QAAQ,aAAa,IAAI;EACxE,OAAO,QAAQ,OAAO,OAAO,KAAK,OAAO,MAAM;EAC/C,SAAS,KAAK;GAAE,MAAM,OAAO;GAAM,OAAO,OAAO;GAAO,QAAQ,OAAO;EAAO,CAAC;EAC/E,IAAI,UAAU,QAAQ;GACpB,iBAAiB;GACjB,IAAI,QAAQ,gBAAA,KAA8B;EAC5C;EACA,QAAQ,sBAAsB,IAAI;CACpC;CACA,MAAM,YAAY;EAChB,IAAI,UAAU,KAAK,CAAC,SAAS,QAAQ,QAAQ,sBAAsB,IAAI;CACzE;CACA,MAAM,qBAAqB;EACzB,IAAI,SAAS,QAAQ;GACnB,qBAAqB,KAAK;GAC1B,QAAQ;EACV,OACE,IAAI;CAER;CAEA,SAAS,iBAAiB,oBAAoB,YAAY;CAC1D,IAAI;CACJ,aAAa;EACX,SAAS,oBAAoB,oBAAoB,YAAY;EAC7D,qBAAqB,KAAK;CAC5B;AACF"}
@@ -0,0 +1,32 @@
1
+ //#region src/voice/orbs.d.ts
2
+ /**
3
+ * The orb: the shape a voice conversation with an agent takes, where it stands and how loud it
4
+ * is. Its styles, its states and its props; the drawing is `Orb`'s.
5
+ */
6
+ /**
7
+ * The ways the orb can be drawn: `wave`, the default, the iOS voice waveform; `fluid-dots`, six
8
+ * dots that merge and scatter. Both are shaders, and each paints its own colours.
9
+ */
10
+ export declare const ORB_STYLES: readonly ["wave", "fluid-dots"];
11
+ export type OrbStyle = (typeof ORB_STYLES)[number];
12
+ /** Where the conversation stands, as the orb shows it: at rest, or the agent listening, thinking or speaking. */
13
+ export type OrbState = "idle" | "listening" | "thinking" | "speaking";
14
+ export interface OrbProps {
15
+ /** Where the conversation stands. The orb looks different in each. */
16
+ state: OrbState;
17
+ /**
18
+ * How loud the microphone (while `listening`) or the voice (while `speaking`) is, from 0 to 1;
19
+ * 0 in the other states. A number, or a reader the orb calls on each frame it draws (a call's
20
+ * meter), so it follows the sound without a render per frame. The orb eases it on its own.
21
+ */
22
+ level: number | (() => number);
23
+ /** The diameter in pixels. Default: 200. */
24
+ size?: number | undefined;
25
+ /** How it is drawn: `"wave"` (the default) or `"fluid-dots"`. */
26
+ style?: OrbStyle | undefined;
27
+ /** What the orb is, for those who cannot see it: its `aria-label`. */
28
+ label: string;
29
+ className?: string | undefined;
30
+ }
31
+ //#endregion
32
+ //# sourceMappingURL=orbs.d.ts.map
@@ -0,0 +1,16 @@
1
+ //#region src/voice/orbs.ts
2
+ /**
3
+ * The orb: the shape a voice conversation with an agent takes, where it stands and how loud it
4
+ * is. Its styles, its states and its props; the drawing is `Orb`'s.
5
+ */
6
+ /**
7
+ * The ways the orb can be drawn: `wave`, the default, the iOS voice waveform; `fluid-dots`, six
8
+ * dots that merge and scatter. Both are shaders, and each paints its own colours.
9
+ */
10
+ const ORB_STYLES = ["wave", "fluid-dots"];
11
+ /** The one drawn when nobody chose. */
12
+ const DEFAULT_ORB = "wave";
13
+ //#endregion
14
+ export { DEFAULT_ORB, ORB_STYLES };
15
+
16
+ //# sourceMappingURL=orbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orbs.js","names":[],"sources":["../../src/voice/orbs.ts"],"sourcesContent":["/**\n * The orb: the shape a voice conversation with an agent takes, where it stands and how loud it\n * is. Its styles, its states and its props; the drawing is `Orb`'s.\n */\n\n/**\n * The ways the orb can be drawn: `wave`, the default, the iOS voice waveform; `fluid-dots`, six\n * dots that merge and scatter. Both are shaders, and each paints its own colours.\n */\nexport const ORB_STYLES = [\"wave\", \"fluid-dots\"] as const;\n\nexport type OrbStyle = (typeof ORB_STYLES)[number];\n\n/** The one drawn when nobody chose. */\nexport const DEFAULT_ORB: OrbStyle = \"wave\";\n\n/** Where the conversation stands, as the orb shows it: at rest, or the agent listening, thinking or speaking. */\nexport type OrbState = \"idle\" | \"listening\" | \"thinking\" | \"speaking\";\n\n/** The diameter when nobody says: room for the orb and the glow it gives off. */\nexport const ORB_SIZE = 200;\n\nexport interface OrbProps {\n /** Where the conversation stands. The orb looks different in each. */\n state: OrbState;\n /**\n * How loud the microphone (while `listening`) or the voice (while `speaking`) is, from 0 to 1;\n * 0 in the other states. A number, or a reader the orb calls on each frame it draws (a call's\n * meter), so it follows the sound without a render per frame. The orb eases it on its own.\n */\n level: number | (() => number);\n /** The diameter in pixels. Default: 200. */\n size?: number | undefined;\n /** How it is drawn: `\"wave\"` (the default) or `\"fluid-dots\"`. */\n style?: OrbStyle | undefined;\n /** What the orb is, for those who cannot see it: its `aria-label`. */\n label: string;\n className?: string | undefined;\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,aAAa,CAAC,QAAQ,YAAY;;AAK/C,MAAa,cAAwB"}
@@ -1,19 +1,19 @@
1
1
  import { useSyncExternalStore } from "react";
2
- const QUERY = "(prefers-reduced-motion: reduce)";
3
- const available = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
4
- function subscribe(changed) {
5
- const query = window.matchMedia(QUERY);
6
- query.addEventListener("change", changed);
7
- return () => {
8
- query.removeEventListener("change", changed);
9
- };
10
- }
11
- const never = () => () => undefined;
2
+ //#region src/voice/useReducedMotion.ts
3
+ const LESS_MOTION = "(prefers-reduced-motion: reduce)";
4
+ const motionQuery = () => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(LESS_MOTION) : null;
12
5
  /**
13
- * Whether the person asked their system for less motion. It follows the setting while the page
14
- * is open. Without `matchMedia` (a server, an old browser) there is no such request.
15
- */
16
- export function useReducedMotion() {
17
- const browser = available();
18
- return useSyncExternalStore(browser ? subscribe : never, () => browser && window.matchMedia(QUERY).matches, () => false);
6
+ * Whether the person asked their system for less motion, followed while the page is open.
7
+ * Without `matchMedia` (a server, an old browser) there is no such request.
8
+ */
9
+ function useReducedMotion() {
10
+ return useSyncExternalStore((changed) => {
11
+ const query = motionQuery();
12
+ query?.addEventListener("change", changed);
13
+ return () => query?.removeEventListener("change", changed);
14
+ }, () => motionQuery()?.matches ?? false, () => false);
19
15
  }
16
+ //#endregion
17
+ export { useReducedMotion };
18
+
19
+ //# sourceMappingURL=useReducedMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReducedMotion.js","names":[],"sources":["../../src/voice/useReducedMotion.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\n\nconst LESS_MOTION = \"(prefers-reduced-motion: reduce)\";\n\nconst motionQuery = (): MediaQueryList | null =>\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(LESS_MOTION)\n : null;\n\n/**\n * Whether the person asked their system for less motion, followed while the page is open.\n * Without `matchMedia` (a server, an old browser) there is no such request.\n */\nexport function useReducedMotion(): boolean {\n return useSyncExternalStore(\n (changed) => {\n const query = motionQuery();\n query?.addEventListener(\"change\", changed);\n return () => query?.removeEventListener(\"change\", changed);\n },\n () => motionQuery()?.matches ?? false,\n () => false,\n );\n}\n"],"mappings":";;AAEA,MAAM,cAAc;AAEpB,MAAM,oBACJ,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aAC1D,OAAO,WAAW,WAAW,IAC7B;;;;;AAMN,SAAgB,mBAA4B;CAC1C,OAAO,sBACJ,YAAY;EACX,MAAM,QAAQ,YAAY;EAC1B,OAAO,iBAAiB,UAAU,OAAO;EACzC,aAAa,OAAO,oBAAoB,UAAU,OAAO;CAC3D,SACM,YAAY,CAAC,EAAE,WAAW,aAC1B,KACR;AACF"}
@@ -0,0 +1,116 @@
1
+ import { CUTOUT, INK, INK_UNIFORMS } from "./webgl.js";
2
+ import { WebGLOrb } from "./WebGLOrb.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ /** At rest the wave breathes at a third of its pace; once something is heard it runs its own. */
5
+ const WAVE = {
6
+ fragment: `precision highp float;
7
+ uniform vec2 iResolution; uniform float iTime;
8
+ uniform float uLevel; uniform float uEnergy; // signalcore: the signal
9
+ ${INK_UNIFORMS}
10
+ const float PI = 3.14159265359;
11
+ const float AMPLITUDE = 0.32;
12
+ const float FREQ = 1.1;
13
+ const float ABER_FREQ = 1.0;
14
+ const float SPEED = 2.4;
15
+ const float WAVE_SCALE = 0.6;
16
+ const float ABERRATION = 2.6;
17
+ const float THICKNESS = 3.0;
18
+ const float INTENSITY = 2.;
19
+ const float FALLOFF = 1.7;
20
+ const float EDGE_MASK = 0.4;
21
+ const float EDGE_INSET = 0.0;
22
+ const float BAND_FILL = 30000.0;
23
+ const float BAND_THICK = 0.08;
24
+ const float SOFTNESS = 2.5;
25
+ const float LOW_AMP = 6.0;
26
+ const float LOW_INT = 1.5;
27
+ const float MID_ABER = 0.8;
28
+ const float MID_ABAMP = 0.05;
29
+ const float MID_BAND = 20.0;
30
+ const float MID_SOFT = 0.4;
31
+ const float HIGH_ABER = 0.5;
32
+ const float HIGH_ABAMP = 0.06;
33
+ const float RESOLVED = 1.0;
34
+ const float UNRES_SCALE = 0.14;
35
+
36
+ vec3 spectral4(int s){
37
+ float x = float(s);
38
+ return clamp(vec3(abs(x-3.0)-1.0, 2.0-abs(x-2.0), 2.0-abs(x-4.0)), 0.0, 1.0);
39
+ }
40
+
41
+ void mainImage(out vec4 fragColor, in vec2 fragCoord){
42
+ vec2 R = iResolution.xy;
43
+ float aspect = R.x / R.y;
44
+ vec2 p = (fragCoord + 0.5) * 2.0 / R - 1.0;
45
+ p.x *= aspect;
46
+ float yScreen = p.y;
47
+ p /= max(WAVE_SCALE, 0.1);
48
+
49
+ float t = iTime;
50
+ float lvl = clamp(uLevel, 0.0, 1.0); // signalcore: the bands the level drives, one shape each
51
+ float low = mix(clamp(0.45 + 0.45*sin(t*0.8)*sin(t*0.37+1.0), 0.0, 1.0), lvl, uEnergy);
52
+ float mid = mix(clamp(0.40 + 0.40*sin(t*1.7+2.0)*sin(t*0.53), 0.0, 1.0), lvl*(0.7 + 0.3*sin(t*5.1+2.0)), uEnergy);
53
+ float high = mix(clamp(0.30 + 0.30*sin(t*2.9+4.0)*sin(t*0.71+2.0), 0.0, 1.0), lvl*lvl*(0.7 + 0.3*sin(t*8.3+4.0)), uEnergy);
54
+
55
+ float res = clamp(RESOLVED, 0.0, 1.0);
56
+ float drift = mod(t, 20.0*PI) * SPEED;
57
+
58
+ float xN = p.x / max(aspect, 1.0);
59
+ float env = cos(PI*0.5 * min(abs(0.9*xN), 1.0));
60
+ env *= env;
61
+
62
+ float A1 = AMPLITUDE + 0.01*low*LOW_AMP;
63
+ float A2 = A1 + mid*MID_ABAMP + high*HIGH_ABAMP;
64
+ float AB = (ABERRATION + mid*MID_ABER + high*HIGH_ABER)*res;
65
+ float th = mix(0.1, 0.01*THICKNESS, res);
66
+ float inten = mix(0.1, 0.01*(INTENSITY + low*LOW_INT), res);
67
+ float soft = 0.01*res*max(0.0, SOFTNESS + mid*MID_SOFT);
68
+
69
+ float dUnres = max(length(p) - mix(0.14, UNRES_SCALE, res), 0.0);
70
+ float yMain = A1 * env * res * sin(p.x*FREQ + drift);
71
+
72
+ float bandFillTh = max(BAND_THICK, 1e-4);
73
+ float bandAmt = 1e-4 * BAND_FILL * inten;
74
+ vec3 num = vec3(0.0), den = vec3(0.0);
75
+ for(int s = 0; s < 4; s++){
76
+ vec3 hue = mix(vec3(1.0), spectral4(s), res);
77
+ den += hue;
78
+ float ab = mix(-AB, AB, float(s)/3.0);
79
+ float yL = A2 * env * res * sin(p.x*ABER_FREQ + drift + ab);
80
+ float d = mix(dUnres, abs(p.y - yL), res);
81
+ float lor = mix(1.0/(1.0 + (0.02*d)*(0.02*d)), 1.0, res);
82
+ float line = inten / (sqrt(d*d + soft*soft) + th);
83
+ float lo = min(yMain, yL), hi = max(yMain, yL);
84
+ float dBand = max(0.0, max(p.y - hi, lo - p.y));
85
+ float band = bandAmt / (dBand + bandFillTh);
86
+ num += hue * lor * (line + band);
87
+ }
88
+ vec3 col = num / den;
89
+
90
+ float dM = mix(dUnres, abs(p.y - yMain), res);
91
+ float lorM = mix(1.0/(1.0 + (0.02*dM)*(0.02*dM)), 1.0, res);
92
+ float boost = (1.0 - res) * (14.0*low + 4.0);
93
+ col += 0.5 * inten * (lorM + boost) / (sqrt(dM*dM + soft*soft) + th);
94
+
95
+ col = pow(max(col, 0.0), vec3(1.5));
96
+ float emT = clamp((abs(yScreen) - 1.0 + EDGE_INSET) / (-max(EDGE_MASK, 1e-4)), 0.0, 1.0);
97
+ float em = emT*emT*(3.0 - 2.0*emT);
98
+ float gauss = exp(-pow(xN*FALLOFF, 2.0));
99
+ col *= mix(1.0, em*gauss, res);
100
+ col *= res;
101
+ fragColor = vec4(col, 1.0);
102
+ }
103
+ void main(){ mainImage(gl_FragColor, gl_FragCoord.xy); ${INK} ${CUTOUT} }`,
104
+ pace: (energy) => .35 + .65 * Math.min(1, energy * 2)
105
+ };
106
+ /** The `wave` style of the orb: the iOS voice waveform. */
107
+ function WaveOrb(props) {
108
+ return /* @__PURE__ */ jsx(WebGLOrb, {
109
+ ...props,
110
+ shader: WAVE
111
+ });
112
+ }
113
+ //#endregion
114
+ export { WAVE, WaveOrb as default };
115
+
116
+ //# sourceMappingURL=wave.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave.js","names":[],"sources":["../../src/voice/wave.tsx"],"sourcesContent":["import type { OrbProps } from \"./orbs\";\nimport { WebGLOrb } from \"./WebGLOrb\";\nimport { CUTOUT, INK, INK_UNIFORMS, type Shader } from \"./webgl\";\n\n/**\n * Ported from siri-wave by 40973894 (21st.dev), MIT. Shaders kept verbatim except the uniforms\n * added below.\n *\n * The `wave` style of the orb: the iOS voice waveform, a bright line with chromatic bands. The\n * original simulated three frequency bands (`low`, `mid`, `high`) with slow sines. Two uniforms\n * are ours, and everything marked `signalcore:` in the source below is where they are used:\n *\n * - `uLevel`, how loud the microphone or the voice is, 0 to 1. The bands follow it.\n * - `uEnergy`, 0 at rest, 0.5 while thinking, 1 while listening or speaking: how much the bands\n * follow the level instead of the original's simulation. At rest the wave breathes on the\n * simulation, slowly (the clock runs at 0.35, see `pace`).\n *\n * The last line of `main` is ours too: the host's colour, when it gives one (`INK`, its uniforms\n * `INK_UNIFORMS`), and what is near black turning transparent (`CUTOUT`).\n */\nconst FRAGMENT = `precision highp float;\nuniform vec2 iResolution; uniform float iTime;\nuniform float uLevel; uniform float uEnergy; // signalcore: the signal\n${INK_UNIFORMS}\nconst float PI = 3.14159265359;\nconst float AMPLITUDE = 0.32;\nconst float FREQ = 1.1;\nconst float ABER_FREQ = 1.0;\nconst float SPEED = 2.4;\nconst float WAVE_SCALE = 0.6;\nconst float ABERRATION = 2.6;\nconst float THICKNESS = 3.0;\nconst float INTENSITY = 2.;\nconst float FALLOFF = 1.7;\nconst float EDGE_MASK = 0.4;\nconst float EDGE_INSET = 0.0;\nconst float BAND_FILL = 30000.0;\nconst float BAND_THICK = 0.08;\nconst float SOFTNESS = 2.5;\nconst float LOW_AMP = 6.0;\nconst float LOW_INT = 1.5;\nconst float MID_ABER = 0.8;\nconst float MID_ABAMP = 0.05;\nconst float MID_BAND = 20.0;\nconst float MID_SOFT = 0.4;\nconst float HIGH_ABER = 0.5;\nconst float HIGH_ABAMP = 0.06;\nconst float RESOLVED = 1.0;\nconst float UNRES_SCALE = 0.14;\n\nvec3 spectral4(int s){\n float x = float(s);\n return clamp(vec3(abs(x-3.0)-1.0, 2.0-abs(x-2.0), 2.0-abs(x-4.0)), 0.0, 1.0);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord){\n vec2 R = iResolution.xy;\n float aspect = R.x / R.y;\n vec2 p = (fragCoord + 0.5) * 2.0 / R - 1.0;\n p.x *= aspect;\n float yScreen = p.y;\n p /= max(WAVE_SCALE, 0.1);\n\n float t = iTime;\n float lvl = clamp(uLevel, 0.0, 1.0); // signalcore: the bands the level drives, one shape each\n float low = mix(clamp(0.45 + 0.45*sin(t*0.8)*sin(t*0.37+1.0), 0.0, 1.0), lvl, uEnergy);\n float mid = mix(clamp(0.40 + 0.40*sin(t*1.7+2.0)*sin(t*0.53), 0.0, 1.0), lvl*(0.7 + 0.3*sin(t*5.1+2.0)), uEnergy);\n float high = mix(clamp(0.30 + 0.30*sin(t*2.9+4.0)*sin(t*0.71+2.0), 0.0, 1.0), lvl*lvl*(0.7 + 0.3*sin(t*8.3+4.0)), uEnergy);\n\n float res = clamp(RESOLVED, 0.0, 1.0);\n float drift = mod(t, 20.0*PI) * SPEED;\n\n float xN = p.x / max(aspect, 1.0);\n float env = cos(PI*0.5 * min(abs(0.9*xN), 1.0));\n env *= env;\n\n float A1 = AMPLITUDE + 0.01*low*LOW_AMP;\n float A2 = A1 + mid*MID_ABAMP + high*HIGH_ABAMP;\n float AB = (ABERRATION + mid*MID_ABER + high*HIGH_ABER)*res;\n float th = mix(0.1, 0.01*THICKNESS, res);\n float inten = mix(0.1, 0.01*(INTENSITY + low*LOW_INT), res);\n float soft = 0.01*res*max(0.0, SOFTNESS + mid*MID_SOFT);\n\n float dUnres = max(length(p) - mix(0.14, UNRES_SCALE, res), 0.0);\n float yMain = A1 * env * res * sin(p.x*FREQ + drift);\n\n float bandFillTh = max(BAND_THICK, 1e-4);\n float bandAmt = 1e-4 * BAND_FILL * inten;\n vec3 num = vec3(0.0), den = vec3(0.0);\n for(int s = 0; s < 4; s++){\n vec3 hue = mix(vec3(1.0), spectral4(s), res);\n den += hue;\n float ab = mix(-AB, AB, float(s)/3.0);\n float yL = A2 * env * res * sin(p.x*ABER_FREQ + drift + ab);\n float d = mix(dUnres, abs(p.y - yL), res);\n float lor = mix(1.0/(1.0 + (0.02*d)*(0.02*d)), 1.0, res);\n float line = inten / (sqrt(d*d + soft*soft) + th);\n float lo = min(yMain, yL), hi = max(yMain, yL);\n float dBand = max(0.0, max(p.y - hi, lo - p.y));\n float band = bandAmt / (dBand + bandFillTh);\n num += hue * lor * (line + band);\n }\n vec3 col = num / den;\n\n float dM = mix(dUnres, abs(p.y - yMain), res);\n float lorM = mix(1.0/(1.0 + (0.02*dM)*(0.02*dM)), 1.0, res);\n float boost = (1.0 - res) * (14.0*low + 4.0);\n col += 0.5 * inten * (lorM + boost) / (sqrt(dM*dM + soft*soft) + th);\n\n col = pow(max(col, 0.0), vec3(1.5));\n float emT = clamp((abs(yScreen) - 1.0 + EDGE_INSET) / (-max(EDGE_MASK, 1e-4)), 0.0, 1.0);\n float em = emT*emT*(3.0 - 2.0*emT);\n float gauss = exp(-pow(xN*FALLOFF, 2.0));\n col *= mix(1.0, em*gauss, res);\n col *= res;\n fragColor = vec4(col, 1.0);\n}\nvoid main(){ mainImage(gl_FragColor, gl_FragCoord.xy); ${INK} ${CUTOUT} }`;\n\n/** At rest the wave breathes at a third of its pace; once something is heard it runs its own. */\nexport const WAVE: Shader = {\n fragment: FRAGMENT,\n pace: (energy) => 0.35 + 0.65 * Math.min(1, energy * 2),\n};\n\n/** The `wave` style of the orb: the iOS voice waveform. */\nexport default function WaveOrb(props: OrbProps) {\n return <WebGLOrb {...props} shader={WAVE} />;\n}\n"],"mappings":";;;;AAwHA,MAAa,OAAe;CAC1B,UAAU;;;EAlGV,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDA8F0C,IAAI,GAAG,OAAO;CAKrE,OAAO,WAAW,MAAO,MAAO,KAAK,IAAI,GAAG,SAAS,CAAC;AACxD;;AAGA,SAAwB,QAAQ,OAAiB;CAC/C,OAAO,oBAAC,UAAD;EAAU,GAAI;EAAO,QAAQ;CAAO,CAAA;AAC7C"}