@superinterface/react 2.13.1 → 2.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2917,7 +2917,7 @@ var useRecorder = function(param) {
2917
2917
  var silenceAnalyser = useMemo11(function() {
2918
2918
  if (!audioEngine) return null;
2919
2919
  var result = audioEngine.audioContext.createAnalyser();
2920
- result.minDecibels = -45;
2920
+ result.minDecibels = -60;
2921
2921
  audioEngine.source.connect(result);
2922
2922
  return result;
2923
2923
  }, [
@@ -2960,9 +2960,9 @@ var useRecorder = function(param) {
2960
2960
  if (status !== "recording") return;
2961
2961
  if (!silenceStart) return;
2962
2962
  if (!noiseStart) return;
2963
- if (!silenceStart.isBefore(dayjs2().subtract(1, "second"))) return;
2963
+ if (!silenceStart.isBefore(dayjs2().subtract(1.5, "second"))) return;
2964
2964
  audioCaptureProps.stop();
2965
- }, 100);
2965
+ }, 300);
2966
2966
  return _object_spread_props(_object_spread({}, audioCaptureProps), {
2967
2967
  status: status,
2968
2968
  visualizationAnalyser: visualizationAnalyser
@@ -3232,7 +3232,8 @@ var Root8 = function(param) {
3232
3232
  });
3233
3233
  };
3234
3234
  // src/components/threads/AudioThread/Visualization/index.tsx
3235
- import { useContext as useContext13 } from "react";
3235
+ import { useContext as useContext13, useState as useState6, useCallback as useCallback5, useEffect as useEffect7 } from "react";
3236
+ import _9 from "lodash";
3236
3237
  import { Flex as Flex22 } from "@radix-ui/themes";
3237
3238
  // src/hooks/threads/useAudioThreadContext/index.ts
3238
3239
  import { useContext as useContext12 } from "react";
@@ -3308,6 +3309,30 @@ import { jsx as jsx57, jsxs as jsxs18 } from "react/jsx-runtime";
3308
3309
  var Visualization = function() {
3309
3310
  var audioThreadContext = useAudioThreadContext();
3310
3311
  var assistantNameContext = useContext13(AssistantNameContext);
3312
+ var _useState6 = _sliced_to_array(useState6(0), 2), scale = _useState6[0], setScale = _useState6[1];
3313
+ var draw = useCallback5(function(param) {
3314
+ var visualizationAnalyser = param.visualizationAnalyser;
3315
+ if (!visualizationAnalyser) {
3316
+ setScale(1);
3317
+ return;
3318
+ }
3319
+ var frequencyData = new Uint8Array(visualizationAnalyser.frequencyBinCount / 15);
3320
+ visualizationAnalyser.getByteFrequencyData(frequencyData);
3321
+ setScale(1 + _9.mean(frequencyData) / 255 / 10);
3322
+ requestAnimationFrame(function() {
3323
+ return draw({
3324
+ visualizationAnalyser: visualizationAnalyser
3325
+ });
3326
+ });
3327
+ }, []);
3328
+ useEffect7(function() {
3329
+ draw({
3330
+ visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser
3331
+ });
3332
+ }, [
3333
+ draw,
3334
+ audioThreadContext
3335
+ ]);
3311
3336
  return /* @__PURE__ */ jsxs18(Flex22, {
3312
3337
  direction: "column",
3313
3338
  align: "center",
@@ -3322,7 +3347,8 @@ var Visualization = function() {
3322
3347
  width: "200px",
3323
3348
  style: {
3324
3349
  backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-4)" : "var(--gray-4)",
3325
- borderRadius: "9999px"
3350
+ borderRadius: "9999px",
3351
+ scale: scale
3326
3352
  },
3327
3353
  children: /* @__PURE__ */ jsx57(BarsVisualizer, {
3328
3354
  visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
@@ -3350,7 +3376,7 @@ import { Flex as Flex23, Text as Text7 } from "@radix-ui/themes";
3350
3376
  import { jsx as jsx58, jsxs as jsxs19 } from "react/jsx-runtime";
3351
3377
  var html = function(param) {
3352
3378
  var texts = param.texts;
3353
- return "\n .status-messages-texts:after {\n content: '".concat(texts[0], "';\n animation: texts ").concat(texts.length * 3, "s linear infinite;\n }\n\n @keyframes texts {\n ").concat(texts.map(function(_9, i) {
3379
+ return "\n .status-messages-texts:after {\n content: '".concat(texts[0], "';\n animation: texts ").concat(texts.length * 5, "s linear infinite;\n }\n\n @keyframes texts {\n ").concat(texts.map(function(_10, i) {
3354
3380
  return "\n ".concat(i * 100 / texts.length, '% {\n content: "').concat(texts[i], '";\n }\n ');
3355
3381
  }).join(""), "\n }");
3356
3382
  };