@superinterface/react 2.18.0 → 2.19.1
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 +110 -9
- 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 +105 -8
- 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 +32 -1
- package/dist/types/index.d.ts +32 -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
|
@@ -439,7 +439,7 @@ var variableParams = function(param) {
|
|
|
439
439
|
};
|
|
440
440
|
// src/lib/threads/queryOptions/index.ts
|
|
441
441
|
var queryOptions = function(param) {
|
|
442
|
-
var queryKeyBase = param.queryKeyBase,
|
|
442
|
+
var queryKeyBase = param.queryKeyBase, path2 = param.path, queryClient = param.queryClient, threadContext = param.threadContext, superinterfaceContext = param.superinterfaceContext;
|
|
443
443
|
var queryKey = _to_consumable_array(queryKeyBase).concat([
|
|
444
444
|
threadContext.variables
|
|
445
445
|
]);
|
|
@@ -459,7 +459,7 @@ var queryOptions = function(param) {
|
|
|
459
459
|
})));
|
|
460
460
|
return [
|
|
461
461
|
2,
|
|
462
|
-
fetch("".concat(superinterfaceContext.baseUrl).concat(
|
|
462
|
+
fetch("".concat(superinterfaceContext.baseUrl).concat(path2, "?").concat(params)).then(function() {
|
|
463
463
|
var _ref = _async_to_generator(function(response) {
|
|
464
464
|
var errorResponse, error;
|
|
465
465
|
return _ts_generator(this, function(_state) {
|
|
@@ -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,128 @@ 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/index.tsx
|
|
4742
|
+
import { Avatar as Avatar4 } from "@radix-ui/themes";
|
|
4743
|
+
// src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/path.ts
|
|
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 path = function(param) {
|
|
4754
|
+
var imageAvatar = param.imageAvatar, size = param.size;
|
|
4755
|
+
return "/_next/image?url=".concat(encodeURIComponent(imageAvatar.url), "&w=").concat(width({
|
|
4756
|
+
size: size
|
|
4757
|
+
}), "&q=95");
|
|
4758
|
+
};
|
|
4759
|
+
// src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/host.ts
|
|
4760
|
+
var host = function(param) {
|
|
4761
|
+
var superinterfaceContext = param.superinterfaceContext;
|
|
4762
|
+
if (!superinterfaceContext.baseUrl) return "";
|
|
4763
|
+
if (!/^https?:\/\//i.test(superinterfaceContext.baseUrl)) return "";
|
|
4764
|
+
return new URL(superinterfaceContext.baseUrl).origin;
|
|
4765
|
+
};
|
|
4766
|
+
// src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/index.ts
|
|
4767
|
+
var optimizedSrc = function(param) {
|
|
4768
|
+
var imageAvatar = param.imageAvatar, size = param.size, superinterfaceContext = param.superinterfaceContext;
|
|
4769
|
+
if (!imageAvatar.url) return "";
|
|
4770
|
+
if (imageAvatar.url.endsWith(".svg")) return imageAvatar.url;
|
|
4771
|
+
return "".concat(host({
|
|
4772
|
+
superinterfaceContext: superinterfaceContext
|
|
4773
|
+
})).concat(path({
|
|
4774
|
+
imageAvatar: imageAvatar,
|
|
4775
|
+
size: size
|
|
4776
|
+
}));
|
|
4777
|
+
};
|
|
4778
|
+
// src/components/imageAvatars/ImageAvatar/index.tsx
|
|
4779
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
4780
|
+
var ImageAvatar = function(param) {
|
|
4781
|
+
var imageAvatar = param.imageAvatar, size = param.size;
|
|
4782
|
+
var superinterfaceContext = useSuperinterfaceContext();
|
|
4783
|
+
return /* @__PURE__ */ jsx80(Avatar4, {
|
|
4784
|
+
fallback: "",
|
|
4785
|
+
src: optimizedSrc({
|
|
4786
|
+
imageAvatar: imageAvatar,
|
|
4787
|
+
size: size,
|
|
4788
|
+
superinterfaceContext: superinterfaceContext
|
|
4789
|
+
}),
|
|
4790
|
+
size: size
|
|
4791
|
+
});
|
|
4792
|
+
};
|
|
4793
|
+
// src/components/iconAvatars/IconAvatar.tsx
|
|
4741
4794
|
import { useMemo as useMemo17 } from "react";
|
|
4795
|
+
import { Avatar as Avatar5 } from "@radix-ui/themes";
|
|
4796
|
+
// src/lib/iconAvatars/iconAvatarComponents.ts
|
|
4797
|
+
import { BackpackIcon, RocketIcon, MagicWandIcon, CubeIcon, TargetIcon, DiscIcon, GlobeIcon, StarIcon, LightningBoltIcon as LightningBoltIcon2, FaceIcon, PersonIcon as PersonIcon2, HeartIcon } from "@radix-ui/react-icons";
|
|
4798
|
+
var _obj;
|
|
4799
|
+
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);
|
|
4800
|
+
// src/components/iconAvatars/IconAvatar.tsx
|
|
4801
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
4802
|
+
var IconAvatar = function(param) {
|
|
4803
|
+
var iconAvatar = param.iconAvatar, size = param.size;
|
|
4804
|
+
var Component = useMemo17(function() {
|
|
4805
|
+
return iconAvatarComponents[iconAvatar.name];
|
|
4806
|
+
}, [
|
|
4807
|
+
iconAvatar
|
|
4808
|
+
]);
|
|
4809
|
+
return /* @__PURE__ */ jsx81(Avatar5, {
|
|
4810
|
+
size: size,
|
|
4811
|
+
fallback: Component ? /* @__PURE__ */ jsx81(Component, {}) : ""
|
|
4812
|
+
});
|
|
4813
|
+
};
|
|
4814
|
+
// src/components/avatars/Avatar.tsx
|
|
4815
|
+
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
4816
|
+
var Avatar6 = function(param) {
|
|
4817
|
+
var avatar = param.avatar, _param_size = param.size, size = _param_size === void 0 ? "1" : _param_size;
|
|
4818
|
+
if (avatar) {
|
|
4819
|
+
if (avatar.type === "IMAGE" /* IMAGE */ && avatar.imageAvatar) {
|
|
4820
|
+
return /* @__PURE__ */ jsx82(ImageAvatar, {
|
|
4821
|
+
imageAvatar: avatar.imageAvatar,
|
|
4822
|
+
size: size
|
|
4823
|
+
});
|
|
4824
|
+
}
|
|
4825
|
+
if (avatar.type === "ICON" /* ICON */ && avatar.iconAvatar) {
|
|
4826
|
+
return /* @__PURE__ */ jsx82(IconAvatar, {
|
|
4827
|
+
iconAvatar: avatar.iconAvatar,
|
|
4828
|
+
size: size
|
|
4829
|
+
});
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
return /* @__PURE__ */ jsx82(RadixAvatar, {
|
|
4833
|
+
fallback: "",
|
|
4834
|
+
size: size
|
|
4835
|
+
});
|
|
4836
|
+
};
|
|
4837
|
+
// src/components/components/ComponentsProvider.tsx
|
|
4838
|
+
import { useMemo as useMemo18 } from "react";
|
|
4742
4839
|
// src/hooks/components/useComponents.ts
|
|
4743
4840
|
import { useContext as useContext16 } from "react";
|
|
4744
4841
|
var useComponents = function() {
|
|
4745
4842
|
return useContext16(ComponentsContext);
|
|
4746
4843
|
};
|
|
4747
4844
|
// src/components/components/ComponentsProvider.tsx
|
|
4748
|
-
import { jsx as
|
|
4845
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
4749
4846
|
var ComponentsProvider = function(_param) {
|
|
4750
4847
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
4751
4848
|
"children"
|
|
4752
4849
|
]);
|
|
4753
4850
|
var prevComponents = useComponents();
|
|
4754
|
-
var value =
|
|
4851
|
+
var value = useMemo18(function() {
|
|
4755
4852
|
return merge(prevComponents, rest);
|
|
4756
4853
|
}, [
|
|
4757
4854
|
rest,
|
|
4758
4855
|
prevComponents
|
|
4759
4856
|
]);
|
|
4760
|
-
return /* @__PURE__ */
|
|
4857
|
+
return /* @__PURE__ */ jsx83(ComponentsContext.Provider, {
|
|
4761
4858
|
value: value,
|
|
4762
4859
|
children: children
|
|
4763
4860
|
});
|
|
4764
4861
|
};
|
|
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 };
|
|
4862
|
+
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
4863
|
//# sourceMappingURL=index.js.map
|