@djangocfg/ui-tools 2.1.374 → 2.1.375
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/ChatRoot-F5XXERXU.cjs +14 -0
- package/dist/{ChatRoot-3LA3DSNY.cjs.map → ChatRoot-F5XXERXU.cjs.map} +1 -1
- package/dist/ChatRoot-T7D7QRCH.mjs +5 -0
- package/dist/{ChatRoot-RIETBE55.mjs.map → ChatRoot-T7D7QRCH.mjs.map} +1 -1
- package/dist/{chunk-PSM3DUTC.mjs → chunk-JXBEKSNT.mjs} +16 -5
- package/dist/chunk-JXBEKSNT.mjs.map +1 -0
- package/dist/{chunk-TAEHNX4W.cjs → chunk-UVIFD3TH.cjs} +15 -4
- package/dist/chunk-UVIFD3TH.cjs.map +1 -0
- package/dist/index.cjs +85 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -1
- package/dist/index.d.ts +86 -1
- package/dist/index.mjs +40 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/tools/Chat/Chat.story.tsx +73 -0
- package/src/tools/Chat/README.md +57 -2
- package/src/tools/Chat/components/Composer.tsx +13 -1
- package/src/tools/Chat/context/ChatProvider.tsx +27 -2
- package/src/tools/Chat/context/index.ts +1 -0
- package/src/tools/Chat/hooks/index.ts +6 -0
- package/src/tools/Chat/hooks/useAutoFocusOnStreamEnd.ts +128 -0
- package/src/tools/Chat/index.ts +4 -0
- package/dist/ChatRoot-3LA3DSNY.cjs +0 -14
- package/dist/ChatRoot-RIETBE55.mjs +0 -5
- package/dist/chunk-PSM3DUTC.mjs.map +0 -1
- package/dist/chunk-TAEHNX4W.cjs.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUVIFD3TH_cjs = require('./chunk-UVIFD3TH.cjs');
|
|
4
|
+
require('./chunk-XACCHZH2.cjs');
|
|
5
|
+
require('./chunk-OLISEQHS.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "ChatRoot", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkUVIFD3TH_cjs.ChatRoot; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=ChatRoot-F5XXERXU.cjs.map
|
|
14
|
+
//# sourceMappingURL=ChatRoot-F5XXERXU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-F5XXERXU.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-T7D7QRCH.mjs"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownMessage } from './chunk-NWUT327A.mjs';
|
|
2
2
|
import { __name } from './chunk-N2XQF2OL.mjs';
|
|
3
|
-
import { createContext, forwardRef, memo, useRef, useImperativeHandle, useCallback,
|
|
3
|
+
import { createContext, forwardRef, useEffect, memo, useRef, useImperativeHandle, useCallback, useMemo, useReducer, useState, useSyncExternalStore, useContext } from 'react';
|
|
4
4
|
import { cn, isDev } from '@djangocfg/ui-core/lib';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { useCopy, useLocalStorage, useMediaQuery } from '@djangocfg/ui-core/hooks';
|
|
@@ -1261,9 +1261,13 @@ function ChatProvider({
|
|
|
1261
1261
|
(v) => typeof v === "string" && v.length > 0
|
|
1262
1262
|
);
|
|
1263
1263
|
}, [audio]);
|
|
1264
|
+
const [composer, setComposer] = useState(null);
|
|
1265
|
+
const registerComposer = useCallback((handle) => {
|
|
1266
|
+
setComposer(handle);
|
|
1267
|
+
}, []);
|
|
1264
1268
|
const value = useMemo(
|
|
1265
|
-
() => ({ ...chat, layout, config, labels, audio: audioApi, hasAudio }),
|
|
1266
|
-
[chat, layout, config, labels, audioApi, hasAudio]
|
|
1269
|
+
() => ({ ...chat, layout, config, labels, audio: audioApi, hasAudio, composer, registerComposer }),
|
|
1270
|
+
[chat, layout, config, labels, audioApi, hasAudio, composer, registerComposer]
|
|
1267
1271
|
);
|
|
1268
1272
|
return /* @__PURE__ */ jsx(Ctx.Provider, { value, children: /* @__PURE__ */ jsx("div", { ref: rootRef, style: { display: "contents" }, children }) });
|
|
1269
1273
|
}
|
|
@@ -1607,6 +1611,13 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1607
1611
|
const onCancel = onCancelProp ?? ctx?.cancelStream;
|
|
1608
1612
|
const isDisabled = disabled ?? isStreaming;
|
|
1609
1613
|
const sz = SIZE_CLASSES[size];
|
|
1614
|
+
const register = ctx?.registerComposer;
|
|
1615
|
+
const composerFocus = composer.focus;
|
|
1616
|
+
useEffect(() => {
|
|
1617
|
+
if (!register) return;
|
|
1618
|
+
register({ focus: composerFocus });
|
|
1619
|
+
return () => register(null);
|
|
1620
|
+
}, [register, composerFocus]);
|
|
1610
1621
|
return /* @__PURE__ */ jsxs(
|
|
1611
1622
|
"div",
|
|
1612
1623
|
{
|
|
@@ -2381,5 +2392,5 @@ function copy(text) {
|
|
|
2381
2392
|
__name(copy, "copy");
|
|
2382
2393
|
|
|
2383
2394
|
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, EmptyState, ErrorBanner, HOTKEYS, JumpToLatest, LIMITS, MessageActions, MessageBubble, MessageList, STORAGE_KEYS, Sources, StreamingIndicator, ToolCalls, createId, createTokenBuffer, deriveInitials, getChatLogger, initialState, reducer, resolvePersona, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatLayout };
|
|
2384
|
-
//# sourceMappingURL=chunk-
|
|
2385
|
-
//# sourceMappingURL=chunk-
|
|
2395
|
+
//# sourceMappingURL=chunk-JXBEKSNT.mjs.map
|
|
2396
|
+
//# sourceMappingURL=chunk-JXBEKSNT.mjs.map
|