@arbidocs/react 0.3.158 → 0.3.160

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.cts CHANGED
@@ -193,6 +193,17 @@ interface ChatBubbleProps {
193
193
  deleted?: boolean;
194
194
  read?: boolean;
195
195
  onDelete?: () => void;
196
+ /**
197
+ * Copy a shareable deep link to this exact message. Optional — the host
198
+ * builds the URL (it knows the workspace/deployment domain, the light
199
+ * package doesn't), this just renders the affordance and calls back.
200
+ */
201
+ onCopyLink?: () => void;
202
+ /** Stable DOM anchor for scroll-to-message (a notification deep link, a
203
+ * "jump to this message" action). Typically the message's external id. */
204
+ id?: string;
205
+ /** Brief highlight flash — set true right after scrolling into view. */
206
+ highlighted?: boolean;
196
207
  /** Last bubble in a same-sender run; shows the timestamp and read receipt. */
197
208
  isLastOfRun?: boolean;
198
209
  /**
package/dist/index.d.ts CHANGED
@@ -193,6 +193,17 @@ interface ChatBubbleProps {
193
193
  deleted?: boolean;
194
194
  read?: boolean;
195
195
  onDelete?: () => void;
196
+ /**
197
+ * Copy a shareable deep link to this exact message. Optional — the host
198
+ * builds the URL (it knows the workspace/deployment domain, the light
199
+ * package doesn't), this just renders the affordance and calls back.
200
+ */
201
+ onCopyLink?: () => void;
202
+ /** Stable DOM anchor for scroll-to-message (a notification deep link, a
203
+ * "jump to this message" action). Typically the message's external id. */
204
+ id?: string;
205
+ /** Brief highlight flash — set true right after scrolling into view. */
206
+ highlighted?: boolean;
196
207
  /** Last bubble in a same-sender run; shows the timestamp and read receipt. */
197
208
  isLastOfRun?: boolean;
198
209
  /**
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { useQuery, useMutation, useQueries, QueryClient, QueryClientProvider, us
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { connectWithReconnect, resolveCitations, summarizeCitations } from '@arbidocs/sdk/browser';
9
9
  export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
10
- import { Trash2, CheckCheck, Check, MessageCircleMore, MoreVertical, MessageSquareLock, Info, FileQuestion, BookOpen, Upload, LogOut, LayoutGrid, Bell, MessageSquare, CircleUserRound, Wrench, Package, ClipboardList, UserPlus, Contact, Settings2, Users, User, NotebookPen, NotebookText, StickyNote, FolderPlus, Hash, EyeOff, Eye, CaptionsOff, FolderOpen, MessageSquareMore, MessageSquarePlus, MessageSquareText, MessageSquareOff, MessagesSquare, Columns3Cog, SquarePlus, SquareM, ChevronsDown, Bot, Calendar, Search, Folder, List, SquareCheckBig, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Image as Image$1, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Activity, Gauge, Gift, PartyPopper, UserCheck, FileX2, FileCheck2, Pencil, SquareArrowOutUpRight, XCircle, CheckCircle2, ArrowRight, ChevronDown, MoreHorizontal, SquarePen, FileX, SkipForward, CheckCircle } from 'lucide-react';
10
+ import { Link, Trash2, CheckCheck, Check, MessageCircleMore, MoreVertical, MessageSquareLock, Info, FileQuestion, BookOpen, Upload, LogOut, LayoutGrid, Bell, MessageSquare, CircleUserRound, Wrench, Package, ClipboardList, UserPlus, Contact, Settings2, Users, User, NotebookPen, NotebookText, StickyNote, FolderPlus, Hash, EyeOff, Eye, CaptionsOff, FolderOpen, MessageSquareMore, MessageSquarePlus, MessageSquareText, MessageSquareOff, MessagesSquare, Columns3Cog, SquarePlus, SquareM, ChevronsDown, Bot, Calendar, Search, Folder, List, SquareCheckBig, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Image as Image$1, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Activity, Gauge, Gift, PartyPopper, UserCheck, FileX2, FileCheck2, Pencil, SquareArrowOutUpRight, XCircle, CheckCircle2, ArrowRight, ChevronDown, MoreHorizontal, SquarePen, FileX, SkipForward, CheckCircle } from 'lucide-react';
11
11
  import { isMessageType } from '@arbidocs/client';
12
12
  export { isMessageType } from '@arbidocs/client';
13
13
  import { create } from 'zustand';
@@ -1346,6 +1346,9 @@ var ChatBubble = memo(function ChatBubble2({
1346
1346
  deleted,
1347
1347
  read,
1348
1348
  onDelete,
1349
+ onCopyLink,
1350
+ id,
1351
+ highlighted,
1349
1352
  isLastOfRun = true,
1350
1353
  senderName,
1351
1354
  classNames,
@@ -1355,11 +1358,12 @@ var ChatBubble = memo(function ChatBubble2({
1355
1358
  }) {
1356
1359
  const [isHovered, setIsHovered] = useState(false);
1357
1360
  const [isFocused, setIsFocused] = useState(false);
1358
- const showDeleteButton = isHovered || isFocused;
1361
+ const showActions = isHovered || isFocused;
1359
1362
  if (deleted) {
1360
1363
  return /* @__PURE__ */ jsx(
1361
1364
  "div",
1362
1365
  {
1366
+ id,
1363
1367
  "data-testid": testId,
1364
1368
  className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
1365
1369
  children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
@@ -1372,9 +1376,25 @@ var ChatBubble = memo(function ChatBubble2({
1372
1376
  !isSent && isLastOfRun && "rounded-bl-sm"
1373
1377
  );
1374
1378
  const bubbleSurface = isSent ? cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
1379
+ const highlightClass = highlighted && "ring-2 ring-blue-400 dark:ring-blue-600";
1380
+ const copyLinkButton = onCopyLink && /* @__PURE__ */ jsx(
1381
+ "button",
1382
+ {
1383
+ onClick: onCopyLink,
1384
+ onFocus: () => setIsFocused(true),
1385
+ onBlur: () => setIsFocused(false),
1386
+ className: cn(
1387
+ "self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1388
+ showActions ? "opacity-100 text-foreground" : "opacity-0 text-muted-foreground"
1389
+ ),
1390
+ "aria-label": "Copy link to this message",
1391
+ children: /* @__PURE__ */ jsx(Link, { className: "w-3.5 h-3.5" })
1392
+ }
1393
+ );
1375
1394
  return /* @__PURE__ */ jsxs(
1376
1395
  "div",
1377
1396
  {
1397
+ id,
1378
1398
  "data-testid": testId,
1379
1399
  className: cn(
1380
1400
  "flex w-full items-end",
@@ -1384,51 +1404,68 @@ var ChatBubble = memo(function ChatBubble2({
1384
1404
  onMouseEnter: () => setIsHovered(true),
1385
1405
  onMouseLeave: () => setIsHovered(false),
1386
1406
  children: [
1387
- isSent && onDelete && /* @__PURE__ */ jsx(
1388
- "button",
1389
- {
1390
- onClick: onDelete,
1391
- onFocus: () => setIsFocused(true),
1392
- onBlur: () => setIsFocused(false),
1393
- className: cn(
1394
- "self-end p-1 mr-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1395
- showDeleteButton ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
1396
- ),
1397
- "aria-label": "Delete message",
1398
- children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
1399
- }
1400
- ),
1401
- /* @__PURE__ */ jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxs("div", { className: cn("px-3.5 py-2 break-words shadow-sm", bubbleRadius, bubbleSurface), children: [
1402
- /* @__PURE__ */ jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
1403
- isLastOfRun && /* @__PURE__ */ jsxs(
1404
- "div",
1407
+ isSent && (copyLinkButton || onDelete) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 mr-1", children: [
1408
+ copyLinkButton,
1409
+ onDelete && /* @__PURE__ */ jsx(
1410
+ "button",
1405
1411
  {
1412
+ onClick: onDelete,
1413
+ onFocus: () => setIsFocused(true),
1414
+ onBlur: () => setIsFocused(false),
1406
1415
  className: cn(
1407
- "flex items-center gap-1.5 mt-0.5",
1408
- isSent ? "justify-end" : "justify-start"
1416
+ "self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1417
+ showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
1409
1418
  ),
1410
- children: [
1411
- senderName && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
1412
- /* @__PURE__ */ jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
1413
- isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
1414
- ]
1419
+ "aria-label": "Delete message",
1420
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
1415
1421
  }
1416
1422
  )
1417
- ] }) }),
1418
- !isSent && onDelete && /* @__PURE__ */ jsx(
1419
- "button",
1423
+ ] }),
1424
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxs(
1425
+ "div",
1420
1426
  {
1421
- onClick: onDelete,
1422
- onFocus: () => setIsFocused(true),
1423
- onBlur: () => setIsFocused(false),
1424
1427
  className: cn(
1425
- "self-end p-1 ml-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1426
- showDeleteButton ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
1428
+ "px-3.5 py-2 break-words shadow-sm transition-shadow",
1429
+ bubbleRadius,
1430
+ bubbleSurface,
1431
+ highlightClass
1427
1432
  ),
1428
- "aria-label": "Delete message",
1429
- children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
1433
+ children: [
1434
+ /* @__PURE__ */ jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
1435
+ isLastOfRun && /* @__PURE__ */ jsxs(
1436
+ "div",
1437
+ {
1438
+ className: cn(
1439
+ "flex items-center gap-1.5 mt-0.5",
1440
+ isSent ? "justify-end" : "justify-start"
1441
+ ),
1442
+ children: [
1443
+ senderName && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
1444
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
1445
+ isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
1446
+ ]
1447
+ }
1448
+ )
1449
+ ]
1430
1450
  }
1431
- )
1451
+ ) }),
1452
+ !isSent && (onDelete || copyLinkButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 ml-1", children: [
1453
+ onDelete && /* @__PURE__ */ jsx(
1454
+ "button",
1455
+ {
1456
+ onClick: onDelete,
1457
+ onFocus: () => setIsFocused(true),
1458
+ onBlur: () => setIsFocused(false),
1459
+ className: cn(
1460
+ "self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1461
+ showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
1462
+ ),
1463
+ "aria-label": "Delete message",
1464
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
1465
+ }
1466
+ ),
1467
+ copyLinkButton
1468
+ ] })
1432
1469
  ]
1433
1470
  }
1434
1471
  );