@superinterface/react 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3304,9 +3304,14 @@ import { jsx as jsx58 } from "react/jsx-runtime";
3304
3304
  var barCount = 4;
3305
3305
  var BarsVisualizer = function(param) {
3306
3306
  var visualizationAnalyser = param.visualizationAnalyser, color = param.color, height = param.height, barWidth = param.barWidth;
3307
- var _useState8 = _sliced_to_array(useState8(function() {
3308
- return new AudioContext().createAnalyser();
3309
- }), 1), emptyVisualizer = _useState8[0];
3307
+ var _useState8 = _sliced_to_array(useState8(null), 2), cachedEmptyVisualizer = _useState8[0], setCachedEmptyVisualizer = _useState8[1];
3308
+ var getEmptyVisualizer = useCallback4(function() {
3309
+ var result = new AudioContext().createAnalyser();
3310
+ setCachedEmptyVisualizer(result);
3311
+ return result;
3312
+ }, [
3313
+ cachedEmptyVisualizer
3314
+ ]);
3310
3315
  var _useState81 = _sliced_to_array(useState8([]), 2), barHeights = _useState81[0], setBarHeights = _useState81[1];
3311
3316
  var draw = useCallback4(function(param) {
3312
3317
  var visualizationAnalyser2 = param.visualizationAnalyser;
@@ -3324,12 +3329,13 @@ var BarsVisualizer = function(param) {
3324
3329
  }, []);
3325
3330
  useEffect9(function() {
3326
3331
  draw({
3327
- visualizationAnalyser: visualizationAnalyser || emptyVisualizer
3332
+ visualizationAnalyser: visualizationAnalyser || cachedEmptyVisualizer || getEmptyVisualizer()
3328
3333
  });
3329
3334
  }, [
3330
3335
  draw,
3331
3336
  visualizationAnalyser,
3332
- emptyVisualizer
3337
+ cachedEmptyVisualizer,
3338
+ getEmptyVisualizer
3333
3339
  ]);
3334
3340
  return /* @__PURE__ */ jsx58(Grid, {
3335
3341
  columns: "".concat(barCount),
@@ -3391,7 +3397,7 @@ var Visualization = function() {
3391
3397
  import { SpeakerModerateIcon } from "@radix-ui/react-icons";
3392
3398
  import { Flex as Flex24 } from "@radix-ui/themes";
3393
3399
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
3394
- import { Flex as Flex23, IconButton as IconButton4, Tooltip } from "@radix-ui/themes";
3400
+ import { Flex as Flex23, IconButton as IconButton4 } from "@radix-ui/themes";
3395
3401
  import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
3396
3402
  import { jsx as jsx60, jsxs as jsxs19 } from "react/jsx-runtime";
3397
3403
  var ActionButton = function() {
@@ -3411,21 +3417,16 @@ var ActionButton = function() {
3411
3417
  children: /* @__PURE__ */ jsx60(PauseIcon, {})
3412
3418
  })
3413
3419
  }),
3414
- /* @__PURE__ */ jsx60(Tooltip, {
3415
- open: true,
3416
- content: "Send your message",
3417
- side: "bottom",
3418
- children: /* @__PURE__ */ jsx60(IconButton4, {
3419
- onClick: audioThreadContext.recorderProps.stop,
3420
- color: "gray",
3421
- highContrast: true,
3422
- radius: "full",
3423
- size: "4",
3424
- style: {
3425
- border: "2px solid var(--gray-8)"
3426
- },
3427
- children: /* @__PURE__ */ jsx60(ArrowUpIcon2, {})
3428
- })
3420
+ /* @__PURE__ */ jsx60(IconButton4, {
3421
+ onClick: audioThreadContext.recorderProps.stop,
3422
+ color: "gray",
3423
+ highContrast: true,
3424
+ radius: "full",
3425
+ size: "4",
3426
+ style: {
3427
+ border: "2px solid var(--gray-8)"
3428
+ },
3429
+ children: /* @__PURE__ */ jsx60(ArrowUpIcon2, {})
3429
3430
  })
3430
3431
  ]
3431
3432
  });
@@ -3567,9 +3568,9 @@ AudioThreadDialog.Trigger = Trigger;
3567
3568
  AudioThreadDialog.Button = Button2;
3568
3569
  AudioThreadDialog.Content = Content4;
3569
3570
  // src/components/suggestions/Suggestions/index.tsx
3570
- import { useMemo as useMemo15 } from "react";
3571
+ import { useMemo as useMemo16 } from "react";
3571
3572
  // src/components/suggestions/Suggestions/Content.tsx
3572
- import { useMemo as useMemo14 } from "react";
3573
+ import { useMemo as useMemo15 } from "react";
3573
3574
  import { isEmpty as isEmpty2 } from "radash";
3574
3575
  import { onlyText } from "react-children-utilities";
3575
3576
  import { Flex as Flex25 } from "@radix-ui/themes";
@@ -3626,7 +3627,7 @@ import { jsx as jsx65 } from "react/jsx-runtime";
3626
3627
  var Content6 = function(param) {
3627
3628
  var children = param.children;
3628
3629
  var isRunActiveProps = useIsRunActive();
3629
- var suggestions = useMemo14(function() {
3630
+ var suggestions = useMemo15(function() {
3630
3631
  return onlyText(children).split(/\r?\n/).filter(function(c) {
3631
3632
  return !isEmpty2(c);
3632
3633
  }).map(function(c) {
@@ -3635,7 +3636,7 @@ var Content6 = function(param) {
3635
3636
  }, [
3636
3637
  children
3637
3638
  ]);
3638
- var isDisabled = useMemo14(function() {
3639
+ var isDisabled = useMemo15(function() {
3639
3640
  return isRunActiveProps.isRunActive;
3640
3641
  }, [
3641
3642
  isRunActiveProps
@@ -3658,7 +3659,7 @@ import { jsx as jsx66 } from "react/jsx-runtime";
3658
3659
  var Suggestions = function(param) {
3659
3660
  var children = param.children;
3660
3661
  var latestMessageProps = useLatestMessage();
3661
- var isDisabled = useMemo15(function() {
3662
+ var isDisabled = useMemo16(function() {
3662
3663
  var // @ts-ignore-next-line
3663
3664
  _latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
3664
3665
  return (_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking;
@@ -3673,14 +3674,14 @@ var Suggestions = function(param) {
3673
3674
  };
3674
3675
  Suggestions.Item = Item;
3675
3676
  // src/components/markdown/MarkdownProvider/index.tsx
3676
- import { useMemo as useMemo16 } from "react";
3677
+ import { useMemo as useMemo17 } from "react";
3677
3678
  import { jsx as jsx67 } from "react/jsx-runtime";
3678
3679
  var MarkdownProvider = function(_param) {
3679
3680
  var children = _param.children, rest = _object_without_properties(_param, [
3680
3681
  "children"
3681
3682
  ]);
3682
3683
  var prevMarkdownContext = useMarkdownContext();
3683
- var value = useMemo16(function() {
3684
+ var value = useMemo17(function() {
3684
3685
  return merge(prevMarkdownContext, rest);
3685
3686
  }, [
3686
3687
  rest,