@superatomai/application-react 0.0.4 → 0.0.5
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 +31 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70392,8 +70392,9 @@ function useSuperAtom({
|
|
|
70392
70392
|
removed.add(msg.id);
|
|
70393
70393
|
}
|
|
70394
70394
|
setMessages((prev) => prev.filter((m) => !removed.has(m.id)));
|
|
70395
|
+
refreshThreads();
|
|
70395
70396
|
return { success: true };
|
|
70396
|
-
}, [resolvedUserId]);
|
|
70397
|
+
}, [resolvedUserId, refreshThreads]);
|
|
70397
70398
|
useEffect(() => {
|
|
70398
70399
|
setMessageActions({ deleteMessage });
|
|
70399
70400
|
return () => setMessageActions({});
|
|
@@ -70556,15 +70557,35 @@ function ChatInput({
|
|
|
70556
70557
|
window.addEventListener("keydown", onKeyDown);
|
|
70557
70558
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
70558
70559
|
}, [showStop, onStop]);
|
|
70559
|
-
|
|
70560
|
+
const resize = useCallback(() => {
|
|
70560
70561
|
const textarea = textareaRef.current;
|
|
70561
70562
|
if (!textarea) return;
|
|
70562
70563
|
textarea.style.height = "auto";
|
|
70563
70564
|
const newHeight = Math.min(textarea.scrollHeight, 200);
|
|
70564
70565
|
textarea.style.height = `${newHeight}px`;
|
|
70565
|
-
|
|
70566
|
-
|
|
70567
|
-
|
|
70566
|
+
setIsMultiline(newHeight > 60);
|
|
70567
|
+
}, []);
|
|
70568
|
+
useEffect(resize, [input, resize]);
|
|
70569
|
+
useEffect(() => {
|
|
70570
|
+
const frame = requestAnimationFrame(resize);
|
|
70571
|
+
document.fonts?.ready.then(resize).catch(() => {
|
|
70572
|
+
});
|
|
70573
|
+
const textarea = textareaRef.current;
|
|
70574
|
+
if (!textarea || typeof ResizeObserver === "undefined") {
|
|
70575
|
+
return () => cancelAnimationFrame(frame);
|
|
70576
|
+
}
|
|
70577
|
+
let width = textarea.clientWidth;
|
|
70578
|
+
const observer = new ResizeObserver(() => {
|
|
70579
|
+
if (textarea.clientWidth === width) return;
|
|
70580
|
+
width = textarea.clientWidth;
|
|
70581
|
+
resize();
|
|
70582
|
+
});
|
|
70583
|
+
observer.observe(textarea);
|
|
70584
|
+
return () => {
|
|
70585
|
+
cancelAnimationFrame(frame);
|
|
70586
|
+
observer.disconnect();
|
|
70587
|
+
};
|
|
70588
|
+
}, [resize]);
|
|
70568
70589
|
const setCursorToEnd = (textarea) => {
|
|
70569
70590
|
setTimeout(() => {
|
|
70570
70591
|
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
|
@@ -70808,7 +70829,7 @@ function MessageBubble({ message, onStop }) {
|
|
|
70808
70829
|
setConfirmOpen(false);
|
|
70809
70830
|
if (!res.success) console.error("[SuperAtom] Could not delete the message:", res.error);
|
|
70810
70831
|
};
|
|
70811
|
-
const deleteButton = deleteMessage && responseComplete && !isAborted ? /* @__PURE__ */ jsx("div", { className: "
|
|
70832
|
+
const deleteButton = deleteMessage && responseComplete && !isAborted ? /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity duration-200", children: /* @__PURE__ */ jsx(
|
|
70812
70833
|
"button",
|
|
70813
70834
|
{
|
|
70814
70835
|
onClick: () => setConfirmOpen(true),
|
|
@@ -70904,12 +70925,12 @@ function MessageBubble({ message, onStop }) {
|
|
|
70904
70925
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-base-content/70", children: "Generating component..." })
|
|
70905
70926
|
] })
|
|
70906
70927
|
] }) }),
|
|
70907
|
-
hasComponent && /* @__PURE__ */
|
|
70928
|
+
hasComponent && /* @__PURE__ */ jsx("div", { id: `box-${message.id}`, className: "w-full px-4 lg:px-16 xl:px-24 2xl:px-32", children: /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
70908
70929
|
/* @__PURE__ */ jsx("div", { className: "rounded-xl shadow-sm bg-base-100 border-2 border-base-300 min-h-[85vh] overflow-auto flex items-center justify-center p-5", children: /* @__PURE__ */ jsx(DSLRenderer, { dsl: message.schema.ui, data: message.schema.data ?? {} }) }),
|
|
70909
70930
|
deleteButton
|
|
70910
|
-
] }),
|
|
70911
|
-
!isStreaming && !hasComponent && hasText && isTextOnly && !isAborted && /* @__PURE__ */ jsx("div", { className: "flex justify-center w-full px-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full md:w-[60vw]", children: [
|
|
70912
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-xl shadow-sm bg-base-100 border-2 border-base-300 p-4 text-base-content", children: /* @__PURE__ */ jsx(Markdown_default, { content: fullText, isStreaming: false }) }),
|
|
70931
|
+
] }) }),
|
|
70932
|
+
!isStreaming && !hasComponent && hasText && isTextOnly && !isAborted && /* @__PURE__ */ jsx("div", { className: "flex justify-center w-full px-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full md:w-[60vw] group relative", children: [
|
|
70933
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-xl shadow-sm bg-base-100 border-2 border-base-300 p-4 pb-10 text-base-content", children: /* @__PURE__ */ jsx(Markdown_default, { content: fullText, isStreaming: false }) }),
|
|
70913
70934
|
deleteButton
|
|
70914
70935
|
] }) }),
|
|
70915
70936
|
/* @__PURE__ */ jsx(
|