@superinterface/react 2.18.0 → 2.19.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.cjs +91 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +86 -6
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +0 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +0 -1
- package/dist/server.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +31 -1
- package/dist/types/index.d.ts +31 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MessagesPage, SerializedMessage, SerializedRunStep, ToolCall } from './types/index.cjs';
|
|
2
|
+
import { MessagesPage, SerializedMessage, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -625,6 +625,11 @@ declare const AssistantNameContext: react.Context<string>;
|
|
|
625
625
|
|
|
626
626
|
declare const UserAvatarContext: react.Context<react_jsx_runtime.JSX.Element>;
|
|
627
627
|
|
|
628
|
+
declare const Avatar: ({ avatar, size, }: {
|
|
629
|
+
avatar: Avatar$1;
|
|
630
|
+
size?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
631
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
632
|
+
|
|
628
633
|
type FunctionComponents = {
|
|
629
634
|
[key: string]: React.ReactNode;
|
|
630
635
|
};
|
|
@@ -686,4 +691,4 @@ declare const RunStep: {
|
|
|
686
691
|
};
|
|
687
692
|
};
|
|
688
693
|
|
|
689
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
694
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MessagesPage, SerializedMessage, SerializedRunStep, ToolCall } from './types/index.js';
|
|
2
|
+
import { MessagesPage, SerializedMessage, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -625,6 +625,11 @@ declare const AssistantNameContext: react.Context<string>;
|
|
|
625
625
|
|
|
626
626
|
declare const UserAvatarContext: react.Context<react_jsx_runtime.JSX.Element>;
|
|
627
627
|
|
|
628
|
+
declare const Avatar: ({ avatar, size, }: {
|
|
629
|
+
avatar: Avatar$1;
|
|
630
|
+
size?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
631
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
632
|
+
|
|
628
633
|
type FunctionComponents = {
|
|
629
634
|
[key: string]: React.ReactNode;
|
|
630
635
|
};
|
|
@@ -686,4 +691,4 @@ declare const RunStep: {
|
|
|
686
691
|
};
|
|
687
692
|
};
|
|
688
693
|
|
|
689
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
694
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.js
CHANGED
|
@@ -1771,7 +1771,6 @@ var useInfiniteScroll = function(param) {
|
|
|
1771
1771
|
if (isFetchingNextPage) return;
|
|
1772
1772
|
if (!inView) return;
|
|
1773
1773
|
if (!hasNextPage) return;
|
|
1774
|
-
console.log("Fetching next page");
|
|
1775
1774
|
fetchNextPage();
|
|
1776
1775
|
}, 500, [
|
|
1777
1776
|
inView,
|
|
@@ -4737,30 +4736,111 @@ var MarkdownProvider = function(_param) {
|
|
|
4737
4736
|
children: children
|
|
4738
4737
|
});
|
|
4739
4738
|
};
|
|
4740
|
-
// src/components/
|
|
4739
|
+
// src/components/avatars/Avatar.tsx
|
|
4740
|
+
import { Avatar as RadixAvatar } from "@radix-ui/themes";
|
|
4741
|
+
// src/components/imageAvatars/ImageAvatar.tsx
|
|
4742
|
+
import { Avatar as Avatar4 } from "@radix-ui/themes";
|
|
4743
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
4744
|
+
var width = function(param) {
|
|
4745
|
+
var size = param.size;
|
|
4746
|
+
if (size === "1") {
|
|
4747
|
+
return 48;
|
|
4748
|
+
} else if (size === "3") {
|
|
4749
|
+
return 96;
|
|
4750
|
+
}
|
|
4751
|
+
return 96;
|
|
4752
|
+
};
|
|
4753
|
+
var optimizedSrc = function(param) {
|
|
4754
|
+
var imageAvatar = param.imageAvatar, size = param.size, superinterfaceContext = param.superinterfaceContext;
|
|
4755
|
+
if (!imageAvatar.url) return "";
|
|
4756
|
+
if (imageAvatar.url.endsWith(".svg")) return imageAvatar.url;
|
|
4757
|
+
if (!superinterfaceContext.baseUrl) return imageAvatar.url;
|
|
4758
|
+
var baseUrl2 = new URL(superinterfaceContext.baseUrl);
|
|
4759
|
+
return new URL("/_next/image?url=".concat(encodeURIComponent(imageAvatar.url), "&w=").concat(width({
|
|
4760
|
+
size: size
|
|
4761
|
+
}), "&q=95"), "".concat(baseUrl2.origin)).toString();
|
|
4762
|
+
};
|
|
4763
|
+
var ImageAvatar = function(param) {
|
|
4764
|
+
var imageAvatar = param.imageAvatar, size = param.size;
|
|
4765
|
+
var superinterfaceContext = useSuperinterfaceContext();
|
|
4766
|
+
return /* @__PURE__ */ jsx80(Avatar4, {
|
|
4767
|
+
fallback: "",
|
|
4768
|
+
src: optimizedSrc({
|
|
4769
|
+
imageAvatar: imageAvatar,
|
|
4770
|
+
size: size,
|
|
4771
|
+
superinterfaceContext: superinterfaceContext
|
|
4772
|
+
}),
|
|
4773
|
+
size: size
|
|
4774
|
+
});
|
|
4775
|
+
};
|
|
4776
|
+
// src/components/iconAvatars/IconAvatar.tsx
|
|
4741
4777
|
import { useMemo as useMemo17 } from "react";
|
|
4778
|
+
import { Avatar as Avatar5 } from "@radix-ui/themes";
|
|
4779
|
+
// src/lib/iconAvatars/iconAvatarComponents.ts
|
|
4780
|
+
import { BackpackIcon, RocketIcon, MagicWandIcon, CubeIcon, TargetIcon, DiscIcon, GlobeIcon, StarIcon, LightningBoltIcon as LightningBoltIcon2, FaceIcon, PersonIcon as PersonIcon2, HeartIcon } from "@radix-ui/react-icons";
|
|
4781
|
+
var _obj;
|
|
4782
|
+
var iconAvatarComponents = (_obj = {}, _define_property(_obj, "BACKPACK" /* BACKPACK */ , BackpackIcon), _define_property(_obj, "ROCKET" /* ROCKET */ , RocketIcon), _define_property(_obj, "MAGIC_WAND" /* MAGIC_WAND */ , MagicWandIcon), _define_property(_obj, "CUBE" /* CUBE */ , CubeIcon), _define_property(_obj, "TARGET" /* TARGET */ , TargetIcon), _define_property(_obj, "DISC" /* DISC */ , DiscIcon), _define_property(_obj, "GLOBE" /* GLOBE */ , GlobeIcon), _define_property(_obj, "STAR" /* STAR */ , StarIcon), _define_property(_obj, "LIGHTNING_BOLT" /* LIGHTNING_BOLT */ , LightningBoltIcon2), _define_property(_obj, "FACE" /* FACE */ , FaceIcon), _define_property(_obj, "PERSON" /* PERSON */ , PersonIcon2), _define_property(_obj, "HEART" /* HEART */ , HeartIcon), _obj);
|
|
4783
|
+
// src/components/iconAvatars/IconAvatar.tsx
|
|
4784
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
4785
|
+
var IconAvatar = function(param) {
|
|
4786
|
+
var iconAvatar = param.iconAvatar, size = param.size;
|
|
4787
|
+
var Component = useMemo17(function() {
|
|
4788
|
+
return iconAvatarComponents[iconAvatar.name];
|
|
4789
|
+
}, [
|
|
4790
|
+
iconAvatar
|
|
4791
|
+
]);
|
|
4792
|
+
return /* @__PURE__ */ jsx81(Avatar5, {
|
|
4793
|
+
size: size,
|
|
4794
|
+
fallback: Component ? /* @__PURE__ */ jsx81(Component, {}) : ""
|
|
4795
|
+
});
|
|
4796
|
+
};
|
|
4797
|
+
// src/components/avatars/Avatar.tsx
|
|
4798
|
+
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
4799
|
+
var Avatar6 = function(param) {
|
|
4800
|
+
var avatar = param.avatar, _param_size = param.size, size = _param_size === void 0 ? "1" : _param_size;
|
|
4801
|
+
if (avatar) {
|
|
4802
|
+
if (avatar.type === "IMAGE" /* IMAGE */ && avatar.imageAvatar) {
|
|
4803
|
+
return /* @__PURE__ */ jsx82(ImageAvatar, {
|
|
4804
|
+
imageAvatar: avatar.imageAvatar,
|
|
4805
|
+
size: size
|
|
4806
|
+
});
|
|
4807
|
+
}
|
|
4808
|
+
if (avatar.type === "ICON" /* ICON */ && avatar.iconAvatar) {
|
|
4809
|
+
return /* @__PURE__ */ jsx82(IconAvatar, {
|
|
4810
|
+
iconAvatar: avatar.iconAvatar,
|
|
4811
|
+
size: size
|
|
4812
|
+
});
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
return /* @__PURE__ */ jsx82(RadixAvatar, {
|
|
4816
|
+
fallback: "",
|
|
4817
|
+
size: size
|
|
4818
|
+
});
|
|
4819
|
+
};
|
|
4820
|
+
// src/components/components/ComponentsProvider.tsx
|
|
4821
|
+
import { useMemo as useMemo18 } from "react";
|
|
4742
4822
|
// src/hooks/components/useComponents.ts
|
|
4743
4823
|
import { useContext as useContext16 } from "react";
|
|
4744
4824
|
var useComponents = function() {
|
|
4745
4825
|
return useContext16(ComponentsContext);
|
|
4746
4826
|
};
|
|
4747
4827
|
// src/components/components/ComponentsProvider.tsx
|
|
4748
|
-
import { jsx as
|
|
4828
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
4749
4829
|
var ComponentsProvider = function(_param) {
|
|
4750
4830
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
4751
4831
|
"children"
|
|
4752
4832
|
]);
|
|
4753
4833
|
var prevComponents = useComponents();
|
|
4754
|
-
var value =
|
|
4834
|
+
var value = useMemo18(function() {
|
|
4755
4835
|
return merge(prevComponents, rest);
|
|
4756
4836
|
}, [
|
|
4757
4837
|
rest,
|
|
4758
4838
|
prevComponents
|
|
4759
4839
|
]);
|
|
4760
|
-
return /* @__PURE__ */
|
|
4840
|
+
return /* @__PURE__ */ jsx83(ComponentsContext.Provider, {
|
|
4761
4841
|
value: value,
|
|
4762
4842
|
children: children
|
|
4763
4843
|
});
|
|
4764
4844
|
};
|
|
4765
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
4845
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, Avatar6 as Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
4766
4846
|
//# sourceMappingURL=index.js.map
|