@superinterface/react 2.11.0 → 2.13.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.
package/dist/index.js CHANGED
@@ -3232,6 +3232,7 @@ 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
3236
  import { Flex as Flex22 } from "@radix-ui/themes";
3236
3237
  // src/hooks/threads/useAudioThreadContext/index.ts
3237
3238
  import { useContext as useContext12 } from "react";
@@ -3303,100 +3304,161 @@ var BarsVisualizer = function(param) {
3303
3304
  });
3304
3305
  };
3305
3306
  // src/components/threads/AudioThread/Visualization/index.tsx
3306
- import { jsx as jsx57 } from "react/jsx-runtime";
3307
+ import { jsx as jsx57, jsxs as jsxs18 } from "react/jsx-runtime";
3307
3308
  var Visualization = function() {
3308
3309
  var audioThreadContext = useAudioThreadContext();
3309
- return /* @__PURE__ */ jsx57(Flex22, {
3310
+ var assistantNameContext = useContext13(AssistantNameContext);
3311
+ return /* @__PURE__ */ jsxs18(Flex22, {
3310
3312
  direction: "column",
3311
3313
  align: "center",
3312
3314
  justify: "center",
3313
3315
  mb: "3",
3314
3316
  flexGrow: "1",
3315
- children: /* @__PURE__ */ jsx57(Flex22, {
3316
- align: "center",
3317
- justify: "center",
3318
- height: "200px",
3319
- width: "200px",
3320
- style: {
3321
- backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-4)" : "var(--gray-4)",
3322
- borderRadius: "9999px"
3323
- },
3324
- children: /* @__PURE__ */ jsx57(BarsVisualizer, {
3325
- visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
3326
- backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-11)" : "var(--gray-11)",
3327
- height: "40px",
3328
- barWidth: "24px"
3317
+ children: [
3318
+ /* @__PURE__ */ jsx57(Flex22, {
3319
+ align: "center",
3320
+ justify: "center",
3321
+ height: "200px",
3322
+ width: "200px",
3323
+ style: {
3324
+ backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-4)" : "var(--gray-4)",
3325
+ borderRadius: "9999px"
3326
+ },
3327
+ children: /* @__PURE__ */ jsx57(BarsVisualizer, {
3328
+ visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
3329
+ backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-11)" : "var(--gray-11)",
3330
+ height: "40px",
3331
+ barWidth: "24px"
3332
+ })
3333
+ }),
3334
+ /* @__PURE__ */ jsxs18(Flex22, {
3335
+ ml: "-22.5px",
3336
+ gap: "3",
3337
+ pt: "5",
3338
+ children: [
3339
+ /* @__PURE__ */ jsx57(AssistantAvatar, {}),
3340
+ /* @__PURE__ */ jsx57(Name, {
3341
+ children: assistantNameContext
3342
+ })
3343
+ ]
3329
3344
  })
3345
+ ]
3346
+ });
3347
+ };
3348
+ // src/components/threads/AudioThread/Status/StatusMessage.tsx
3349
+ import { Flex as Flex23, Text as Text7 } from "@radix-ui/themes";
3350
+ import { jsx as jsx58 } from "react/jsx-runtime";
3351
+ var StatusMessage = function(param) {
3352
+ var children = param.children;
3353
+ return /* @__PURE__ */ jsx58(Flex23, {
3354
+ justify: "center",
3355
+ pb: "9",
3356
+ children: /* @__PURE__ */ jsx58(Text7, {
3357
+ size: "2",
3358
+ weight: "regular",
3359
+ color: "gray",
3360
+ children: children
3330
3361
  })
3331
3362
  });
3332
3363
  };
3364
+ // src/components/threads/AudioThread/Status/index.tsx
3365
+ import { jsx as jsx59 } from "react/jsx-runtime";
3366
+ var Status = function() {
3367
+ var audioThreadContext = useAudioThreadContext();
3368
+ if (audioThreadContext.status === "recording") {
3369
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3370
+ children: "Listening"
3371
+ });
3372
+ }
3373
+ if ([
3374
+ "recorderPaused",
3375
+ "idle",
3376
+ "playerPaused"
3377
+ ].includes(audioThreadContext.status)) {
3378
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3379
+ children: "Click to activate"
3380
+ });
3381
+ }
3382
+ if (audioThreadContext.status === "playing") {
3383
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3384
+ children: "Click to interrupt"
3385
+ });
3386
+ }
3387
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3388
+ children: "Thinking"
3389
+ });
3390
+ };
3333
3391
  // src/components/threads/AudioThread/Form/index.tsx
3334
- import { SpeakerModerateIcon } from "@radix-ui/react-icons";
3335
- import { Flex as Flex24 } from "@radix-ui/themes";
3392
+ import { Flex as Flex25 } from "@radix-ui/themes";
3393
+ // src/components/threads/AudioThread/Form/MicIcon.tsx
3394
+ import { jsx as jsx60 } from "react/jsx-runtime";
3395
+ var MicIcon = function(props) {
3396
+ return /* @__PURE__ */ jsx60("svg", _object_spread_props(_object_spread({
3397
+ xmlns: "http://www.w3.org/2000/svg",
3398
+ fill: "currentColor",
3399
+ stroke: "currentColor",
3400
+ strokeWidth: 0,
3401
+ viewBox: "0 0 384 512",
3402
+ height: "15",
3403
+ width: "15"
3404
+ }, props), {
3405
+ children: /* @__PURE__ */ jsx60("path", {
3406
+ stroke: "none",
3407
+ d: "M192 0c-53 0-96 43-96 96v160c0 53 43 96 96 96s96-43 96-96V96c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 89.1 66.2 162.7 152 174.4V464h-48c-13.3 0-24 10.7-24 24s10.7 24 24 24h144c13.3 0 24-10.7 24-24s-10.7-24-24-24h-48v-33.6c85.8-11.7 152-85.3 152-174.4v-40c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 70.7-57.3 128-128 128S64 326.7 64 256v-40z"
3408
+ })
3409
+ }));
3410
+ };
3336
3411
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
3337
- import { Flex as Flex23, IconButton as IconButton4 } from "@radix-ui/themes";
3412
+ import { Flex as Flex24, IconButton as IconButton4 } from "@radix-ui/themes";
3338
3413
  import { StopIcon as StopIcon2, PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
3339
- import { jsx as jsx58, jsxs as jsxs18 } from "react/jsx-runtime";
3414
+ import { jsx as jsx61, jsxs as jsxs19 } from "react/jsx-runtime";
3340
3415
  var ActionButton = function() {
3341
3416
  var audioThreadContext = useAudioThreadContext();
3342
3417
  var superinterfaceContext = useSuperinterfaceContext();
3343
3418
  if (audioThreadContext.status === "recording") {
3344
- return /* @__PURE__ */ jsxs18(Flex23, {
3419
+ return /* @__PURE__ */ jsxs19(Flex24, {
3345
3420
  align: "center",
3346
3421
  children: [
3347
- /* @__PURE__ */ jsx58(Flex23, {
3422
+ /* @__PURE__ */ jsx61(Flex24, {
3348
3423
  mr: "3",
3349
3424
  ml: "-7",
3350
- children: /* @__PURE__ */ jsx58(IconButton4, {
3425
+ children: /* @__PURE__ */ jsx61(IconButton4, {
3351
3426
  onClick: audioThreadContext.recorderProps.pause,
3352
3427
  color: "gray",
3353
- radius: "full",
3354
3428
  variant: "soft",
3355
3429
  size: "1",
3356
- children: /* @__PURE__ */ jsx58(PauseIcon, {})
3430
+ children: /* @__PURE__ */ jsx61(PauseIcon, {})
3357
3431
  })
3358
3432
  }),
3359
- /* @__PURE__ */ jsx58(IconButton4, {
3433
+ /* @__PURE__ */ jsx61(IconButton4, {
3360
3434
  onClick: audioThreadContext.recorderProps.stop,
3361
3435
  highContrast: true,
3362
- radius: "full",
3363
3436
  variant: "soft",
3364
3437
  size: "4",
3365
- style: {
3366
- border: "2px solid var(--gray-8)"
3367
- },
3368
- children: /* @__PURE__ */ jsx58(ArrowUpIcon2, {})
3438
+ children: /* @__PURE__ */ jsx61(ArrowUpIcon2, {})
3369
3439
  })
3370
3440
  ]
3371
3441
  });
3372
3442
  }
3373
3443
  if (audioThreadContext.status === "recorderPaused") {
3374
- return /* @__PURE__ */ jsx58(IconButton4, {
3444
+ return /* @__PURE__ */ jsx61(IconButton4, {
3375
3445
  onClick: audioThreadContext.recorderProps.resume,
3376
3446
  color: "red",
3377
- radius: "full",
3378
3447
  size: "4",
3379
- style: {
3380
- border: "2px solid var(--gray-8)"
3381
- },
3382
- children: /* @__PURE__ */ jsx58(ResumeIcon, {})
3448
+ children: /* @__PURE__ */ jsx61(ResumeIcon, {})
3383
3449
  });
3384
3450
  }
3385
3451
  if (audioThreadContext.status === "idle") {
3386
- return /* @__PURE__ */ jsx58(IconButton4, {
3452
+ return /* @__PURE__ */ jsx61(IconButton4, {
3387
3453
  onClick: function() {
3388
3454
  return audioThreadContext.recorderProps.start();
3389
3455
  },
3390
3456
  size: "4",
3391
- color: "red",
3392
- radius: "full",
3393
- style: {
3394
- border: "2px solid var(--gray-8)"
3395
- }
3457
+ color: "red"
3396
3458
  });
3397
3459
  }
3398
3460
  if (audioThreadContext.status === "playing") {
3399
- return /* @__PURE__ */ jsx58(IconButton4, {
3461
+ return /* @__PURE__ */ jsx61(IconButton4, {
3400
3462
  onClick: function() {
3401
3463
  var _superinterfaceContext_createMessageAbortControllerRef_current;
3402
3464
  audioThreadContext.messageAudioProps.stop();
@@ -3405,67 +3467,55 @@ var ActionButton = function() {
3405
3467
  },
3406
3468
  size: "4",
3407
3469
  color: "gray",
3408
- radius: "full",
3409
3470
  variant: "soft",
3410
- style: {
3411
- border: "2px solid var(--gray-8)"
3412
- },
3413
- children: /* @__PURE__ */ jsx58(StopIcon2, {})
3471
+ children: /* @__PURE__ */ jsx61(StopIcon2, {})
3414
3472
  });
3415
3473
  }
3416
3474
  if (audioThreadContext.status === "playerPaused") {
3417
- return /* @__PURE__ */ jsx58(IconButton4, {
3475
+ return /* @__PURE__ */ jsx61(IconButton4, {
3418
3476
  onClick: function() {
3419
3477
  return audioThreadContext.messageAudioProps.play();
3420
3478
  },
3421
3479
  size: "4",
3422
- radius: "full",
3423
- style: {
3424
- border: "2px solid var(--gray-8)"
3425
- },
3426
- children: /* @__PURE__ */ jsx58(ResumeIcon, {})
3480
+ children: /* @__PURE__ */ jsx61(ResumeIcon, {})
3427
3481
  });
3428
3482
  }
3429
- return /* @__PURE__ */ jsx58(IconButton4, {
3483
+ return /* @__PURE__ */ jsx61(IconButton4, {
3430
3484
  size: "4",
3431
- radius: "full",
3432
3485
  variant: "soft",
3433
- disabled: true,
3434
- style: {
3435
- border: "2px solid var(--gray-8)"
3436
- }
3486
+ disabled: true
3437
3487
  });
3438
3488
  };
3439
3489
  // src/components/threads/AudioThread/Form/index.tsx
3440
- import { jsx as jsx59, jsxs as jsxs19 } from "react/jsx-runtime";
3490
+ import { jsx as jsx62, jsxs as jsxs20 } from "react/jsx-runtime";
3441
3491
  var Form = function() {
3442
3492
  var audioThreadContext = useAudioThreadContext();
3443
- return /* @__PURE__ */ jsxs19(Flex24, {
3493
+ return /* @__PURE__ */ jsxs20(Flex25, {
3444
3494
  direction: "column",
3445
3495
  align: "center",
3446
3496
  children: [
3447
- /* @__PURE__ */ jsxs19(Flex24, {
3497
+ /* @__PURE__ */ jsxs20(Flex25, {
3448
3498
  pb: "3",
3449
3499
  align: "center",
3450
3500
  children: [
3451
- /* @__PURE__ */ jsx59(Flex24, {
3452
- ml: "-5",
3501
+ /* @__PURE__ */ jsx62(Flex25, {
3502
+ ml: "-22.5px",
3453
3503
  mr: "2",
3454
3504
  align: "center",
3455
- children: /* @__PURE__ */ jsx59(SpeakerModerateIcon, {
3505
+ children: /* @__PURE__ */ jsx62(MicIcon, {
3456
3506
  style: {
3457
- color: audioThreadContext.status === "recording" ? "var(--accent-12)" : "var(--gray-12)"
3507
+ color: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)"
3458
3508
  }
3459
3509
  })
3460
3510
  }),
3461
- /* @__PURE__ */ jsx59(Flex24, {
3511
+ /* @__PURE__ */ jsx62(Flex25, {
3462
3512
  px: "2",
3463
3513
  py: "1",
3464
3514
  style: {
3465
3515
  backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-4)" : "var(--gray-4)",
3466
3516
  borderRadius: "var(--radius-6)"
3467
3517
  },
3468
- children: /* @__PURE__ */ jsx59(BarsVisualizer, {
3518
+ children: /* @__PURE__ */ jsx62(BarsVisualizer, {
3469
3519
  visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser,
3470
3520
  backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)",
3471
3521
  height: "20px",
@@ -3474,17 +3524,18 @@ var Form = function() {
3474
3524
  })
3475
3525
  ]
3476
3526
  }),
3477
- /* @__PURE__ */ jsx59(ActionButton, {})
3527
+ /* @__PURE__ */ jsx62(ActionButton, {})
3478
3528
  ]
3479
3529
  });
3480
3530
  };
3481
3531
  // src/components/threads/AudioThread/index.tsx
3482
- import { jsx as jsx60, jsxs as jsxs20 } from "react/jsx-runtime";
3532
+ import { jsx as jsx63, jsxs as jsxs21 } from "react/jsx-runtime";
3483
3533
  var AudioThread = function(props) {
3484
- return /* @__PURE__ */ jsxs20(Root8, _object_spread_props(_object_spread({}, props), {
3534
+ return /* @__PURE__ */ jsxs21(Root8, _object_spread_props(_object_spread({}, props), {
3485
3535
  children: [
3486
- /* @__PURE__ */ jsx60(Visualization, {}),
3487
- /* @__PURE__ */ jsx60(Form, {})
3536
+ /* @__PURE__ */ jsx63(Visualization, {}),
3537
+ /* @__PURE__ */ jsx63(Status, {}),
3538
+ /* @__PURE__ */ jsx63(Form, {})
3488
3539
  ]
3489
3540
  }));
3490
3541
  };
@@ -3492,15 +3543,15 @@ AudioThread.Root = Root8;
3492
3543
  AudioThread.Visualization = Visualization;
3493
3544
  AudioThread.Form = Form;
3494
3545
  // src/components/threads/AudioThreadDialog/index.tsx
3495
- import { jsx as jsx61, jsxs as jsxs21 } from "react/jsx-runtime";
3546
+ import { jsx as jsx64, jsxs as jsxs22 } from "react/jsx-runtime";
3496
3547
  var AudioThreadDialog = function() {
3497
- return /* @__PURE__ */ jsxs21(Root6, {
3548
+ return /* @__PURE__ */ jsxs22(Root6, {
3498
3549
  children: [
3499
- /* @__PURE__ */ jsx61(Content4.Root, {
3500
- children: /* @__PURE__ */ jsx61(AudioThread, {})
3550
+ /* @__PURE__ */ jsx64(Content4.Root, {
3551
+ children: /* @__PURE__ */ jsx64(AudioThread, {})
3501
3552
  }),
3502
- /* @__PURE__ */ jsx61(Trigger, {
3503
- children: /* @__PURE__ */ jsx61(Button2, {})
3553
+ /* @__PURE__ */ jsx64(Trigger, {
3554
+ children: /* @__PURE__ */ jsx64(Button2, {})
3504
3555
  })
3505
3556
  ]
3506
3557
  });
@@ -3515,15 +3566,15 @@ import { useMemo as useMemo14 } from "react";
3515
3566
  import { useMemo as useMemo13 } from "react";
3516
3567
  import { isEmpty as isEmpty2 } from "radash";
3517
3568
  import { onlyText } from "react-children-utilities";
3518
- import { Flex as Flex25 } from "@radix-ui/themes";
3569
+ import { Flex as Flex26 } from "@radix-ui/themes";
3519
3570
  // src/components/suggestions/Suggestions/Item.tsx
3520
3571
  import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
3521
- import { Text as Text7, Button as Button3, Spinner } from "@radix-ui/themes";
3522
- import { jsx as jsx62, jsxs as jsxs22 } from "react/jsx-runtime";
3572
+ import { Text as Text8, Button as Button3, Spinner } from "@radix-ui/themes";
3573
+ import { jsx as jsx65, jsxs as jsxs23 } from "react/jsx-runtime";
3523
3574
  var Item = function(param) {
3524
3575
  var suggestion = param.suggestion, isDisabled = param.isDisabled;
3525
3576
  var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
3526
- return /* @__PURE__ */ jsx62(Content5, {
3577
+ return /* @__PURE__ */ jsx65(Content5, {
3527
3578
  onClick: function() {
3528
3579
  createMessage({
3529
3580
  // @ts-ignore-next-line
@@ -3537,7 +3588,7 @@ var Item = function(param) {
3537
3588
  };
3538
3589
  var Content5 = function(param) {
3539
3590
  var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
3540
- return /* @__PURE__ */ jsxs22(Button3, {
3591
+ return /* @__PURE__ */ jsxs23(Button3, {
3541
3592
  variant: "soft",
3542
3593
  onClick: onClick,
3543
3594
  disabled: isDisabled,
@@ -3547,14 +3598,14 @@ var Content5 = function(param) {
3547
3598
  flexShrink: 1
3548
3599
  },
3549
3600
  children: [
3550
- /* @__PURE__ */ jsx62(Text7, {
3601
+ /* @__PURE__ */ jsx65(Text8, {
3551
3602
  size: "1",
3552
3603
  weight: "regular",
3553
3604
  children: children
3554
3605
  }),
3555
- /* @__PURE__ */ jsx62(Spinner, {
3606
+ /* @__PURE__ */ jsx65(Spinner, {
3556
3607
  loading: isPending,
3557
- children: /* @__PURE__ */ jsx62(ArrowUpIcon3, {
3608
+ children: /* @__PURE__ */ jsx65(ArrowUpIcon3, {
3558
3609
  style: {
3559
3610
  flexShrink: 0
3560
3611
  }
@@ -3565,7 +3616,7 @@ var Content5 = function(param) {
3565
3616
  };
3566
3617
  Item.Content = Content5;
3567
3618
  // src/components/suggestions/Suggestions/Content.tsx
3568
- import { jsx as jsx63 } from "react/jsx-runtime";
3619
+ import { jsx as jsx66 } from "react/jsx-runtime";
3569
3620
  var Content6 = function(param) {
3570
3621
  var children = param.children;
3571
3622
  var isMutatingMessage = useIsMutatingMessage();
@@ -3579,12 +3630,12 @@ var Content6 = function(param) {
3579
3630
  children
3580
3631
  ]);
3581
3632
  if (isEmpty2(suggestions)) return null;
3582
- return /* @__PURE__ */ jsx63(Flex25, {
3633
+ return /* @__PURE__ */ jsx66(Flex26, {
3583
3634
  gap: "2",
3584
3635
  py: "2",
3585
3636
  wrap: "wrap",
3586
3637
  children: suggestions.map(function(suggestion) {
3587
- return /* @__PURE__ */ jsx63(Item, {
3638
+ return /* @__PURE__ */ jsx66(Item, {
3588
3639
  suggestion: suggestion,
3589
3640
  isDisabled: isMutatingMessage
3590
3641
  }, suggestion);
@@ -3592,7 +3643,7 @@ var Content6 = function(param) {
3592
3643
  });
3593
3644
  };
3594
3645
  // src/components/suggestions/Suggestions/index.tsx
3595
- import { jsx as jsx64 } from "react/jsx-runtime";
3646
+ import { jsx as jsx67 } from "react/jsx-runtime";
3596
3647
  var Suggestions = function(param) {
3597
3648
  var children = param.children;
3598
3649
  var latestMessageProps = useLatestMessage();
@@ -3605,14 +3656,14 @@ var Suggestions = function(param) {
3605
3656
  ]);
3606
3657
  if (latestMessageProps.isLoading) return null;
3607
3658
  if (isDisabled) return null;
3608
- return /* @__PURE__ */ jsx64(Content6, {
3659
+ return /* @__PURE__ */ jsx67(Content6, {
3609
3660
  children: children
3610
3661
  });
3611
3662
  };
3612
3663
  Suggestions.Item = Item;
3613
3664
  // src/components/markdown/MarkdownProvider/index.tsx
3614
3665
  import { useMemo as useMemo15 } from "react";
3615
- import { jsx as jsx65 } from "react/jsx-runtime";
3666
+ import { jsx as jsx68 } from "react/jsx-runtime";
3616
3667
  var MarkdownProvider = function(_param) {
3617
3668
  var children = _param.children, rest = _object_without_properties(_param, [
3618
3669
  "children"
@@ -3624,7 +3675,7 @@ var MarkdownProvider = function(_param) {
3624
3675
  rest,
3625
3676
  prevMarkdownContext
3626
3677
  ]);
3627
- return /* @__PURE__ */ jsx65(MarkdownContext.Provider, {
3678
+ return /* @__PURE__ */ jsx68(MarkdownContext.Provider, {
3628
3679
  value: value,
3629
3680
  children: children
3630
3681
  });