@superinterface/react 2.16.0 → 2.16.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.d.cts CHANGED
@@ -439,19 +439,16 @@ declare const Suggestions: {
439
439
  };
440
440
 
441
441
  declare const MarkdownContext: react.Context<{
442
- remarkPlugins: any[];
443
- rehypeReactOptions: {
444
- components: {
445
- p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
446
- a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
447
- strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
448
- ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
449
- ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
450
- li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
451
- pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
452
- code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
453
- img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
454
- };
442
+ components: {
443
+ p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
444
+ a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
445
+ strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
446
+ ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
447
+ ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
448
+ li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
449
+ pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
450
+ code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
451
+ img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
455
452
  };
456
453
  }>;
457
454
 
@@ -460,19 +457,16 @@ declare const MarkdownProvider: ({ children, ...rest }: {
460
457
  }) => react_jsx_runtime.JSX.Element;
461
458
 
462
459
  declare const useMarkdownContext: () => {
463
- remarkPlugins: any[];
464
- rehypeReactOptions: {
465
- components: {
466
- p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
467
- a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
468
- strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
469
- ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
470
- ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
471
- li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
472
- pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
473
- code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
474
- img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
475
- };
460
+ components: {
461
+ p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
462
+ a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
463
+ strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
464
+ ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
465
+ ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
466
+ li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
467
+ pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
468
+ code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
469
+ img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
476
470
  };
477
471
  };
478
472
 
package/dist/index.d.ts CHANGED
@@ -439,19 +439,16 @@ declare const Suggestions: {
439
439
  };
440
440
 
441
441
  declare const MarkdownContext: react.Context<{
442
- remarkPlugins: any[];
443
- rehypeReactOptions: {
444
- components: {
445
- p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
446
- a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
447
- strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
448
- ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
449
- ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
450
- li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
451
- pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
452
- code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
453
- img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
454
- };
442
+ components: {
443
+ p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
444
+ a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
445
+ strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
446
+ ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
447
+ ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
448
+ li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
449
+ pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
450
+ code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
451
+ img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
455
452
  };
456
453
  }>;
457
454
 
@@ -460,19 +457,16 @@ declare const MarkdownProvider: ({ children, ...rest }: {
460
457
  }) => react_jsx_runtime.JSX.Element;
461
458
 
462
459
  declare const useMarkdownContext: () => {
463
- remarkPlugins: any[];
464
- rehypeReactOptions: {
465
- components: {
466
- p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
467
- a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
468
- strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
469
- ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
470
- ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
471
- li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
472
- pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
473
- code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
474
- img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
475
- };
460
+ components: {
461
+ p: ({ children }: JSX.IntrinsicElements["p"]) => react_jsx_runtime.JSX.Element;
462
+ a: ({ children, href }: react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => react_jsx_runtime.JSX.Element;
463
+ strong: ({ children }: JSX.IntrinsicElements["strong"]) => react_jsx_runtime.JSX.Element;
464
+ ul: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
465
+ ol: ({ children }: JSX.IntrinsicElements["ul"]) => react_jsx_runtime.JSX.Element;
466
+ li: ({ children }: JSX.IntrinsicElements["li"]) => react_jsx_runtime.JSX.Element;
467
+ pre: ({ children }: JSX.IntrinsicElements["pre"]) => react_jsx_runtime.JSX.Element;
468
+ code: ({ children }: JSX.IntrinsicElements["code"]) => react_jsx_runtime.JSX.Element;
469
+ img: (props: JSX.IntrinsicElements["img"]) => react_jsx_runtime.JSX.Element;
476
470
  };
477
471
  };
478
472
 
package/dist/index.js CHANGED
@@ -10,6 +10,47 @@ function _array_with_holes(arr) {
10
10
  function _array_without_holes(arr) {
11
11
  if (Array.isArray(arr)) return _array_like_to_array(arr);
12
12
  }
13
+ function _async_iterator(iterable) {
14
+ var method, async, sync, retry = 2;
15
+ for("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;){
16
+ if (async && null != (method = iterable[async])) return method.call(iterable);
17
+ if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
18
+ async = "@@asyncIterator", sync = "@@iterator";
19
+ }
20
+ throw new TypeError("Object is not async iterable");
21
+ }
22
+ function AsyncFromSyncIterator(s) {
23
+ function AsyncFromSyncIteratorContinuation(r) {
24
+ if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
25
+ var done = r.done;
26
+ return Promise.resolve(r.value).then(function(value) {
27
+ return {
28
+ value: value,
29
+ done: done
30
+ };
31
+ });
32
+ }
33
+ return AsyncFromSyncIterator = function(s) {
34
+ this.s = s, this.n = s.next;
35
+ }, AsyncFromSyncIterator.prototype = {
36
+ s: null,
37
+ n: null,
38
+ next: function() {
39
+ return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
40
+ },
41
+ return: function(value) {
42
+ var ret = this.s.return;
43
+ return void 0 === ret ? Promise.resolve({
44
+ value: value,
45
+ done: !0
46
+ }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
47
+ },
48
+ throw: function(value) {
49
+ var thr = this.s.return;
50
+ return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
51
+ }
52
+ }, new AsyncFromSyncIterator(s);
53
+ }
13
54
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
14
55
  try {
15
56
  var info = gen[key](arg);
@@ -263,6 +304,20 @@ function _ts_generator(thisArg, body) {
263
304
  };
264
305
  }
265
306
  }
307
+ function _ts_values(o) {
308
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
309
+ if (m) return m.call(o);
310
+ if (o && typeof o.length === "number") return {
311
+ next: function() {
312
+ if (o && i >= o.length) o = void 0;
313
+ return {
314
+ value: o && o[i++],
315
+ done: !o
316
+ };
317
+ }
318
+ };
319
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
320
+ }
266
321
  var _2;
267
322
  var _detect;
268
323
  import { useRef } from "react";
@@ -1246,10 +1301,7 @@ var components = {
1246
1301
  };
1247
1302
  // src/contexts/markdown/MarkdownContext/index.ts
1248
1303
  var MarkdownContext = createContext9({
1249
- remarkPlugins: [],
1250
- rehypeReactOptions: {
1251
- components: components
1252
- }
1304
+ components: components
1253
1305
  });
1254
1306
  // src/hooks/markdown/useMarkdownContext/index.ts
1255
1307
  var useMarkdownContext = function() {
@@ -2587,6 +2639,7 @@ var Preview = function() {
2587
2639
  };
2588
2640
  // src/components/threads/Thread/MessageForm/Field/Files/Control.tsx
2589
2641
  import { useCallback as useCallback2 } from "react";
2642
+ import { omit as omit4 } from "radash";
2590
2643
  import dayjs2 from "dayjs";
2591
2644
  import { FilePlusIcon } from "@radix-ui/react-icons";
2592
2645
  import { IconButton as IconButton3, Flex as Flex16 } from "@radix-ui/themes";
@@ -2706,50 +2759,174 @@ var Control2 = function() {
2706
2759
  var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading, setFiles = _useMessageFormContext.setFiles;
2707
2760
  var createFile = useCreateFile().createFile;
2708
2761
  var addToast = useToasts().addToast;
2709
- var onChange = useCallback2(function(event) {
2710
- var files = event.target.files;
2711
- if (!files) return;
2712
- var newFiles = Array.from(files).map(function(file) {
2713
- var id = optimisticId();
2714
- createFile({
2715
- file: file
2716
- }, {
2717
- onSuccess: function(param) {
2718
- var file2 = param.file;
2719
- setFiles(function(prev) {
2720
- return _to_consumable_array(prev.filter(function(prevFile) {
2721
- return prevFile.id !== id;
2722
- })).concat([
2723
- file2
2724
- ]);
2725
- });
2726
- },
2727
- onError: function() {
2728
- addToast({
2729
- type: "error",
2730
- message: "Could not upload file. Please try again."
2731
- });
2732
- setFiles(function(prev) {
2733
- return prev.filter(function(prevFile) {
2734
- return prevFile.id !== id;
2762
+ var onChange = useCallback2(function() {
2763
+ var _ref = _async_to_generator(function(event) {
2764
+ var fileObjects, newFiles, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
2765
+ return _ts_generator(this, function(_state) {
2766
+ switch(_state.label){
2767
+ case 0:
2768
+ fileObjects = event.target.files;
2769
+ if (!fileObjects) return [
2770
+ 2
2771
+ ];
2772
+ newFiles = Array.from(fileObjects).map(function(fileObject) {
2773
+ return {
2774
+ id: optimisticId(),
2775
+ filename: fileObject.name,
2776
+ object: "file",
2777
+ purpose: "assistants",
2778
+ created_at: dayjs2().unix(),
2779
+ bytes: fileObject.size,
2780
+ status: "processed",
2781
+ fileObject: fileObject
2782
+ };
2783
+ });
2784
+ setFiles(function(prev) {
2785
+ return _to_consumable_array(prev).concat(_to_consumable_array(newFiles.map(function(file) {
2786
+ return omit4(file, [
2787
+ "fileObject"
2788
+ ]);
2789
+ })));
2735
2790
  });
2736
- });
2791
+ _iteratorAbruptCompletion = false, _didIteratorError = false;
2792
+ _state.label = 1;
2793
+ case 1:
2794
+ _state.trys.push([
2795
+ 1,
2796
+ 7,
2797
+ 8,
2798
+ 13
2799
+ ]);
2800
+ _loop = function() {
2801
+ var _value, newFile;
2802
+ return _ts_generator(this, function(_state) {
2803
+ switch(_state.label){
2804
+ case 0:
2805
+ _value = _step.value;
2806
+ newFile = _value;
2807
+ return [
2808
+ 4,
2809
+ createFile({
2810
+ file: newFile.fileObject
2811
+ }, {
2812
+ onSuccess: function(param) {
2813
+ var file = param.file;
2814
+ return setFiles(function(prev) {
2815
+ return _to_consumable_array(prev.filter(function(prevFile) {
2816
+ return prevFile.id !== newFile.id;
2817
+ })).concat([
2818
+ file
2819
+ ]);
2820
+ });
2821
+ },
2822
+ onError: function() {
2823
+ addToast({
2824
+ type: "error",
2825
+ message: "Could not upload file. Please try again."
2826
+ });
2827
+ setFiles(function(prev) {
2828
+ return prev.filter(function(prevFile) {
2829
+ return prevFile.id !== newFile.id;
2830
+ });
2831
+ });
2832
+ }
2833
+ })
2834
+ ];
2835
+ case 1:
2836
+ _state.sent();
2837
+ return [
2838
+ 2
2839
+ ];
2840
+ }
2841
+ });
2842
+ };
2843
+ _iterator = _async_iterator(newFiles);
2844
+ _state.label = 2;
2845
+ case 2:
2846
+ return [
2847
+ 4,
2848
+ _iterator.next()
2849
+ ];
2850
+ case 3:
2851
+ if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
2852
+ 3,
2853
+ 6
2854
+ ];
2855
+ return [
2856
+ 5,
2857
+ _ts_values(_loop())
2858
+ ];
2859
+ case 4:
2860
+ _state.sent();
2861
+ _state.label = 5;
2862
+ case 5:
2863
+ _iteratorAbruptCompletion = false;
2864
+ return [
2865
+ 3,
2866
+ 2
2867
+ ];
2868
+ case 6:
2869
+ return [
2870
+ 3,
2871
+ 13
2872
+ ];
2873
+ case 7:
2874
+ err = _state.sent();
2875
+ _didIteratorError = true;
2876
+ _iteratorError = err;
2877
+ return [
2878
+ 3,
2879
+ 13
2880
+ ];
2881
+ case 8:
2882
+ _state.trys.push([
2883
+ 8,
2884
+ ,
2885
+ 11,
2886
+ 12
2887
+ ]);
2888
+ if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
2889
+ 3,
2890
+ 10
2891
+ ];
2892
+ return [
2893
+ 4,
2894
+ _iterator.return()
2895
+ ];
2896
+ case 9:
2897
+ _state.sent();
2898
+ _state.label = 10;
2899
+ case 10:
2900
+ return [
2901
+ 3,
2902
+ 12
2903
+ ];
2904
+ case 11:
2905
+ if (_didIteratorError) {
2906
+ throw _iteratorError;
2907
+ }
2908
+ return [
2909
+ 7
2910
+ ];
2911
+ case 12:
2912
+ return [
2913
+ 7
2914
+ ];
2915
+ case 13:
2916
+ return [
2917
+ 2
2918
+ ];
2737
2919
  }
2738
2920
  });
2739
- return {
2740
- id: id,
2741
- filename: file.name,
2742
- object: "file",
2743
- purpose: "assistants",
2744
- created_at: dayjs2().unix(),
2745
- bytes: file.size,
2746
- status: "processed"
2747
- };
2748
- });
2749
- setFiles(function(prev) {
2750
- return _to_consumable_array(prev).concat(_to_consumable_array(newFiles));
2751
2921
  });
2752
- }, []);
2922
+ return function(event) {
2923
+ return _ref.apply(this, arguments);
2924
+ };
2925
+ }(), [
2926
+ addToast,
2927
+ createFile,
2928
+ setFiles
2929
+ ]);
2753
2930
  return /* @__PURE__ */ jsx50(Flex16, {
2754
2931
  pt: "2",
2755
2932
  pr: "2",
@@ -2767,6 +2944,7 @@ var Control2 = function() {
2767
2944
  /* @__PURE__ */ jsx50(FilePlusIcon, {}),
2768
2945
  /* @__PURE__ */ jsx50("input", {
2769
2946
  type: "file",
2947
+ multiple: true,
2770
2948
  accept: accept,
2771
2949
  onChange: onChange,
2772
2950
  style: {