@nextclaw/agent-chat-ui 0.3.17 → 0.3.18
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.ts +1 -0
- package/dist/index.js +23 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -307,6 +307,7 @@ type ChatInputBarHandle = {
|
|
|
307
307
|
label: string;
|
|
308
308
|
}>) => void;
|
|
309
309
|
focusComposer: () => void;
|
|
310
|
+
focusComposerAtEnd: () => void;
|
|
310
311
|
};
|
|
311
312
|
declare const ChatInputBar: _$react.ForwardRefExoticComponent<ChatInputBarProps & _$react.RefAttributes<ChatInputBarHandle>>;
|
|
312
313
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1512,6 +1512,9 @@ var LexicalComposerHandleOwner = class {
|
|
|
1512
1512
|
this.focusComposer = () => {
|
|
1513
1513
|
this.params.focusComposer();
|
|
1514
1514
|
};
|
|
1515
|
+
this.focusComposerAtEnd = () => {
|
|
1516
|
+
this.params.focusComposerAtEnd();
|
|
1517
|
+
};
|
|
1515
1518
|
this.syncSelectedSkills = (nextKeys, options) => {
|
|
1516
1519
|
this.params.publishSnapshot(syncSelectedSkillsIntoChatComposer({
|
|
1517
1520
|
nextKeys,
|
|
@@ -1737,10 +1740,23 @@ const ChatInputBarTokenizedComposer = forwardRef(function ChatInputBarTokenizedC
|
|
|
1737
1740
|
const focusComposer = () => {
|
|
1738
1741
|
const editor = editorRef.current;
|
|
1739
1742
|
if (!editor) return;
|
|
1743
|
+
editor.getRootElement()?.focus({ preventScroll: true });
|
|
1740
1744
|
const targetSelection = selectionRef.current;
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1745
|
+
if (targetSelection) syncLexicalSelectionFromChatComposerSelection(editor, targetSelection);
|
|
1746
|
+
editor.focus();
|
|
1747
|
+
};
|
|
1748
|
+
const focusComposerAtEnd = () => {
|
|
1749
|
+
const editor = editorRef.current;
|
|
1750
|
+
if (!editor) return;
|
|
1751
|
+
const end = readChatComposerSnapshotFromEditorState(editor.getEditorState()).nodes.reduce((cursor, node) => cursor + (node.type === "text" ? node.text.length : 1), 0);
|
|
1752
|
+
const targetSelection = {
|
|
1753
|
+
start: end,
|
|
1754
|
+
end
|
|
1755
|
+
};
|
|
1756
|
+
selectionRef.current = targetSelection;
|
|
1757
|
+
editor.getRootElement()?.focus({ preventScroll: true });
|
|
1758
|
+
syncLexicalSelectionFromChatComposerSelection(editor, targetSelection);
|
|
1759
|
+
editor.focus();
|
|
1744
1760
|
};
|
|
1745
1761
|
const readComposerSnapshot = () => ({
|
|
1746
1762
|
nodes: readCurrentNodes(),
|
|
@@ -1748,6 +1764,7 @@ const ChatInputBarTokenizedComposer = forwardRef(function ChatInputBarTokenizedC
|
|
|
1748
1764
|
});
|
|
1749
1765
|
useImperativeHandle(ref, () => createLexicalComposerHandle({
|
|
1750
1766
|
focusComposer,
|
|
1767
|
+
focusComposerAtEnd,
|
|
1751
1768
|
onSlashItemSelect: props.onSlashItemSelect,
|
|
1752
1769
|
optionsReader: readComposerSnapshot,
|
|
1753
1770
|
publishSnapshot
|
|
@@ -1913,7 +1930,8 @@ const ChatInputBar = forwardRef(function ChatInputBar(props, ref) {
|
|
|
1913
1930
|
useImperativeHandle(ref, () => ({
|
|
1914
1931
|
insertFileToken: (tokenKey, label) => composerRef.current?.insertFileToken(tokenKey, label),
|
|
1915
1932
|
insertFileTokens: (tokens) => composerRef.current?.insertFileTokens(tokens),
|
|
1916
|
-
focusComposer: () => composerRef.current?.focusComposer()
|
|
1933
|
+
focusComposer: () => composerRef.current?.focusComposer(),
|
|
1934
|
+
focusComposerAtEnd: () => composerRef.current?.focusComposerAtEnd()
|
|
1917
1935
|
}), []);
|
|
1918
1936
|
return /* @__PURE__ */ jsx("div", {
|
|
1919
1937
|
className: "border-t border-gray-200/80 bg-white p-4",
|
|
@@ -3797,9 +3815,6 @@ const TYPING_TEXT_SHEEN_CSS = `
|
|
|
3797
3815
|
0% {
|
|
3798
3816
|
background-position: 160% 0;
|
|
3799
3817
|
}
|
|
3800
|
-
64% {
|
|
3801
|
-
background-position: -60% 0;
|
|
3802
|
-
}
|
|
3803
3818
|
100% {
|
|
3804
3819
|
background-position: -60% 0;
|
|
3805
3820
|
}
|
|
@@ -3822,7 +3837,7 @@ const TYPING_TEXT_SHEEN_CSS = `
|
|
|
3822
3837
|
background-clip: text;
|
|
3823
3838
|
color: transparent;
|
|
3824
3839
|
-webkit-text-fill-color: transparent;
|
|
3825
|
-
animation: nextclaw-chat-typing-text-sheen
|
|
3840
|
+
animation: nextclaw-chat-typing-text-sheen 2.5s linear infinite;
|
|
3826
3841
|
}
|
|
3827
3842
|
|
|
3828
3843
|
@media (prefers-reduced-motion: reduce) {
|