@djangocfg/ui-tools 2.1.369 → 2.1.371

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.
@@ -0,0 +1,5 @@
1
+ export { ChatRoot } from './chunk-MVAT6OPZ.mjs';
2
+ import './chunk-NWUT327A.mjs';
3
+ import './chunk-N2XQF2OL.mjs';
4
+ //# sourceMappingURL=ChatRoot-DYMCNGOB.mjs.map
5
+ //# sourceMappingURL=ChatRoot-DYMCNGOB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-DENECC2Q.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-DYMCNGOB.mjs"}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var chunk2SKR4U5S_cjs = require('./chunk-2SKR4U5S.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 chunk2SKR4U5S_cjs.ChatRoot; }
12
+ });
13
+ //# sourceMappingURL=ChatRoot-HOQ37WRE.cjs.map
14
+ //# sourceMappingURL=ChatRoot-HOQ37WRE.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-PW6U3QVF.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-HOQ37WRE.cjs"}
@@ -2156,6 +2156,7 @@ var MessageList = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(func
2156
2156
  const ctx = useChatContextOptional();
2157
2157
  const messages = messagesProp ?? ctx?.messages ?? [];
2158
2158
  const isLoadingMore = isLoadingMoreProp ?? ctx?.isLoadingMore ?? false;
2159
+ const { copyToClipboard } = hooks.useCopy();
2159
2160
  const virtuosoRef = react.useRef(null);
2160
2161
  react.useImperativeHandle(
2161
2162
  ref,
@@ -2181,15 +2182,18 @@ var MessageList = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(func
2181
2182
  MessageBubble,
2182
2183
  {
2183
2184
  message: m,
2184
- onCopy: () => copy(m.content),
2185
+ onCopy: () => void copyToClipboard(m.content),
2185
2186
  onRegenerate: ctx ? () => void ctx.regenerate(m.id) : void 0,
2186
2187
  onDelete: ctx ? () => ctx.deleteMessage(m.id) : void 0
2187
2188
  }
2188
2189
  ) }),
2189
- [itemClassName, ctx]
2190
+ [itemClassName, ctx, copyToClipboard]
2190
2191
  );
2191
2192
  const itemRenderer = renderItem ?? defaultRenderItem;
2192
- const computeItemKey = react.useCallback((index, m) => m.id ?? index, []);
2193
+ const computeItemKey = react.useCallback(
2194
+ (index, m) => m?.id ?? index,
2195
+ []
2196
+ );
2193
2197
  const startReachedHandler = react.useMemo(() => {
2194
2198
  if (!onStartReached) return void 0;
2195
2199
  let inFlight = false;
@@ -2242,7 +2246,7 @@ var MessageList = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(func
2242
2246
  className: lib.cn("flex-1", className),
2243
2247
  data: messages,
2244
2248
  computeItemKey,
2245
- itemContent: (index, m) => itemRenderer(m, index),
2249
+ itemContent: (index, m) => m ? itemRenderer(m, index) : null,
2246
2250
  defaultItemHeight,
2247
2251
  followOutput: (isAtBottom) => isAtBottom ? "auto" : false,
2248
2252
  atBottomStateChange: onAtBottomChange,
@@ -2250,17 +2254,12 @@ var MessageList = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(func
2250
2254
  startReached: startReachedHandler,
2251
2255
  components: isLoadingMore ? {
2252
2256
  Header: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-2", children: /* @__PURE__ */ jsxRuntime.jsx(components.Spinner, { className: "size-4 text-muted-foreground" }) }), "Header")
2253
- } : void 0,
2257
+ } : EMPTY_COMPONENTS,
2254
2258
  increaseViewportBy: { top: 200, bottom: 400 }
2255
2259
  }
2256
2260
  );
2257
2261
  }, "MessageList"));
2258
- function copy(text) {
2259
- if (typeof navigator !== "undefined" && navigator.clipboard) {
2260
- void navigator.clipboard.writeText(text);
2261
- }
2262
- }
2263
- chunkOLISEQHS_cjs.__name(copy, "copy");
2262
+ var EMPTY_COMPONENTS = {};
2264
2263
  function ChatRoot(props) {
2265
2264
  const { transport, config, initialSessionId, autoCreateSession, streaming, audio, debug, className, listClassName, ...slots } = props;
2266
2265
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -2310,7 +2309,7 @@ function ChatRootShell({ className, listClassName, slots }) {
2310
2309
  toolCallsProps: slots.toolCallsProps,
2311
2310
  attachmentRenderers: slots.attachmentRenderers,
2312
2311
  onAttachmentOpen: slots.onAttachmentOpen,
2313
- onCopy: () => copy2(m.content),
2312
+ onCopy: () => copy(m.content),
2314
2313
  onRegenerate: () => void chat.regenerate(m.id),
2315
2314
  onDelete: () => chat.deleteMessage(m.id)
2316
2315
  },
@@ -2364,12 +2363,12 @@ function ChatRootShell({ className, listClassName, slots }) {
2364
2363
  ] });
2365
2364
  }
2366
2365
  chunkOLISEQHS_cjs.__name(ChatRootShell, "ChatRootShell");
2367
- function copy2(text) {
2366
+ function copy(text) {
2368
2367
  if (typeof navigator !== "undefined" && navigator.clipboard) {
2369
2368
  void navigator.clipboard.writeText(text);
2370
2369
  }
2371
2370
  }
2372
- chunkOLISEQHS_cjs.__name(copy2, "copy");
2371
+ chunkOLISEQHS_cjs.__name(copy, "copy");
2373
2372
 
2374
2373
  exports.Attachments = Attachments;
2375
2374
  exports.AttachmentsGrid = AttachmentsGrid;
@@ -2408,5 +2407,5 @@ exports.useChatComposer = useChatComposer;
2408
2407
  exports.useChatContext = useChatContext;
2409
2408
  exports.useChatContextOptional = useChatContextOptional;
2410
2409
  exports.useChatLayout = useChatLayout;
2411
- //# sourceMappingURL=chunk-OD3P64QD.cjs.map
2412
- //# sourceMappingURL=chunk-OD3P64QD.cjs.map
2410
+ //# sourceMappingURL=chunk-2SKR4U5S.cjs.map
2411
+ //# sourceMappingURL=chunk-2SKR4U5S.cjs.map