@ttt-productions/chat-react 0.12.9 → 0.12.11

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../src/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,WAAW,CAAC,KA+B3B;IACC,MAAM,EACJ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,eAAe,EACf,QAAQ,EACR,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,UAAU,GAAG,KAAK,EAClB,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACrF,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,UAAU,CAAC;IAErF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,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C,QAAQ,eACZ,OAAO,IAAI,CACV,cAAK,SAAS,EAAC,0BAA0B,YAEvC,cAAK,SAAS,EAAC,qBAAqB,YACjC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,GACvC,GACF,CACP,EACA,IAAI,KATc,CAAC,CAAC,SAAS,CAUf,CAClB,CAAC;wBACJ,CAAC,CAAC,GACE,CACP,IACG,EAEL,CAAC,WAAW,GAAG,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAC1C,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,gBACG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,iCAAiC,CAAC,CAAC,CAAC,kBAAkB,EAClG,SAAS,EAAC,0EAA0E,EACpF,OAAO,EAAE,GAAG,EAAE;oBACZ,cAAc,EAAE,CAAC;oBACjB,gBAAgB,EAAE,EAAE,CAAC;gBACvB,CAAC,YAEA,WAAW,GAAG,CAAC;oBACd,CAAC,CAAC,GAAG,WAAW,eAAe,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI;oBAC7D,CAAC,CAAC,GAAG,GACA,CACV,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport type { ChatMessageV1, ModerationHandlers } from \"@ttt-productions/chat-core\";\nimport { isContinuation } from \"@ttt-productions/chat-core\";\nimport type { MessageRendererRegistry } from \"../types.js\";\nimport { Button } from \"@ttt-productions/ui-core/react\";\nimport { MessageItemDefault } from \"./MessageItemDefault.js\";\n\nexport function MessageList(props: {\n messages: ChatMessageV1[];\n currentUserId: string;\n isAdmin: boolean;\n\n isFetchingOlder?: boolean;\n hasOlder?: boolean;\n onLoadOlder?: () => void;\n\n renderMessage?: (m: ChatMessageV1) => React.ReactNode;\n messageRenderers?: MessageRendererRegistry;\n\n showScrollToBottom?: boolean;\n onScrollToBottom?: () => void;\n /** Reports whether the list is scrolled to the bottom so the consumer can advance\n * authoritative read state only when the latest message is actually in view (C-B6). */\n onAtBottomChange?: (atBottom: boolean) => void;\n /** Class for the scrollable message region. Overrides the default. The default is\n * `h-[400px]` (fixed-height card) unless `fillHeight` is set, in which case it is\n * `flex-1 min-h-0`. */\n scrollClassName?: string;\n /** Fill the parent's height instead of a fixed `h-[400px]`. Makes the list a flex-col\n * that flexes to fill its container, so a bounded-height page panel scrolls inside.\n * The consuming layout must give MessageList's ancestor a bounded height (ChatShell's\n * `fillHeight` wires Card → CardContent → MessageList for this). */\n fillHeight?: boolean;\n\n handlers?: ModerationHandlers;\n onSenderClick?: (senderId: string, displayName: string) => void;\n /** Retry a failed realtime send by clientMessageId (realtime transport only). */\n onRetrySend?: (clientMessageId: string) => void;\n}) {\n const {\n messages,\n currentUserId,\n isAdmin,\n isFetchingOlder,\n hasOlder,\n onLoadOlder,\n renderMessage,\n messageRenderers,\n showScrollToBottom,\n onScrollToBottom,\n onAtBottomChange,\n scrollClassName,\n fillHeight = false,\n handlers,\n onSenderClick,\n onRetrySend,\n } = props;\n\n const scrollClass = scrollClassName ?? (fillHeight ? \"flex-1 min-h-0\" : \"h-[400px]\");\n const outerClass = fillHeight ? \"relative flex flex-col flex-1 min-h-0\" : \"relative\";\n\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const topSentinelRef = React.useRef<HTMLDivElement>(null);\n\n const isAtBottomRef = React.useRef(true);\n const prevScrollHeightRef = React.useRef<number | null>(null);\n const prevCountRef = React.useRef(0);\n\n // Count of messages that arrived while the user was scrolled up — drives the\n // \"new messages\" pill. Reset when the user returns to the bottom.\n const [unseenCount, setUnseenCount] = React.useState(0);\n\n const scrollToBottom = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n el.scrollTop = el.scrollHeight;\n isAtBottomRef.current = true;\n setUnseenCount(0);\n onAtBottomChange?.(true);\n }, [onAtBottomChange]);\n\n // IntersectionObserver for infinite scroll (older messages)\n React.useEffect(() => {\n const root = scrollRef.current;\n const target = topSentinelRef.current;\n if (!root || !target) return;\n if (typeof IntersectionObserver === \"undefined\") return;\n\n const io = new IntersectionObserver(\n (entries) => {\n const e = entries[0];\n if (!e?.isIntersecting) return;\n if (!hasOlder || isFetchingOlder) return;\n\n prevScrollHeightRef.current = root.scrollHeight;\n onLoadOlder?.();\n },\n { root, threshold: 0 }\n );\n\n io.observe(target);\n return () => io.disconnect();\n }, [hasOlder, isFetchingOlder, onLoadOlder]);\n\n // Scroll management — FIXES accordion scroll jump\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n\n const count = messages.length;\n const prev = prevCountRef.current;\n\n if (prev === 0 && count > 0) {\n // Initial load — scroll to bottom WITHOUT triggering parent scroll\n requestAnimationFrame(() => {\n const savedScrollY = window.scrollY;\n el.scrollTop = el.scrollHeight;\n // Restore page scroll if the browser moved it\n if (window.scrollY !== savedScrollY) {\n window.scrollTo({ top: savedScrollY, behavior: \"instant\" as ScrollBehavior });\n }\n });\n isAtBottomRef.current = true;\n } else if (count > prev && prevScrollHeightRef.current != null) {\n // Older messages prepended — maintain scroll position\n const diff = el.scrollHeight - prevScrollHeightRef.current;\n el.scrollTop += diff;\n prevScrollHeightRef.current = null;\n } else if (count > prev && isAtBottomRef.current) {\n // New message at bottom, user is at bottom — scroll down\n // Use scrollTop assignment, NOT scrollTo with behavior:\"smooth\" (causes parent scroll jump)\n requestAnimationFrame(() => {\n const savedScrollY = window.scrollY;\n el.scrollTop = el.scrollHeight;\n if (window.scrollY !== savedScrollY) {\n window.scrollTo({ top: savedScrollY, behavior: \"instant\" as ScrollBehavior });\n }\n });\n } else if (count > prev) {\n // New message(s) arrived while the user was scrolled up — surface the pill\n // instead of yanking their scroll position.\n setUnseenCount((c) => c + (count - prev));\n }\n\n prevCountRef.current = count;\n }, [messages]);\n\n const onScroll = (e: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;\n const atBottom = scrollHeight - (scrollTop + clientHeight) < 50;\n if (atBottom !== isAtBottomRef.current) onAtBottomChange?.(atBottom);\n isAtBottomRef.current = atBottom;\n if (atBottom && unseenCount !== 0) setUnseenCount(0);\n };\n\n let lastDay: string | null = null;\n\n return (\n <div className={outerClass}>\n <div ref={scrollRef} className={`${scrollClass} overflow-y-auto p-4`} onScroll={onScroll}>\n {isFetchingOlder && <div className=\"text-center text-xs opacity-70 mb-2\">Loading…</div>}\n\n <div ref={topSentinelRef} />\n\n {messages.length === 0 ? (\n <div className=\"h-full flex items-center justify-center text-sm opacity-70\">No messages yet</div>\n ) : (\n <div className=\"flex flex-col\">\n {messages.map((m, idx) => {\n const day = new Date(m.createdAt).toDateString();\n const showDay = day !== lastDay;\n lastDay = day;\n\n const prevMsg = idx > 0 ? messages[idx - 1] : undefined;\n // Date separators always break grouping\n const continuation = showDay ? false : isContinuation(prevMsg, m);\n\n const byType =\n m.type && messageRenderers?.[m.type] ? messageRenderers[m.type]!(m) : null;\n\n const body =\n renderMessage?.(m) ??\n byType ?? (\n <MessageItemDefault\n m={m}\n currentUserId={currentUserId}\n isAdmin={isAdmin}\n handlers={handlers}\n isContinuation={continuation}\n onSenderClick={onSenderClick}\n onRetrySend={onRetrySend}\n />\n );\n\n return (\n <React.Fragment key={m.messageId}>\n {showDay && (\n <div className=\"my-2 flex justify-center\">\n {/* theme-core: components.css */}\n <div className=\"chat-date-separator\">\n {new Date(m.createdAt).toLocaleDateString()}\n </div>\n </div>\n )}\n {body}\n </React.Fragment>\n );\n })}\n </div>\n )}\n </div>\n\n {(unseenCount > 0 || showScrollToBottom) && (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n aria-label={unseenCount > 0 ? `${unseenCount} new messages, scroll to latest` : \"Scroll to latest\"}\n className=\"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full shadow-sm gap-1\"\n onClick={() => {\n scrollToBottom();\n onScrollToBottom?.();\n }}\n >\n {unseenCount > 0\n ? `${unseenCount} new message${unseenCount > 1 ? \"s\" : \"\"} ↓`\n : \"↓\"}\n </Button>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../src/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,WAAW,CAAC,KAkC3B;IACC,MAAM,EACJ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,eAAe,EACf,QAAQ,EACR,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,UAAU,GAAG,KAAK,EAClB,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,GAClB,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACrF,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,UAAU,CAAC;IAErF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IA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CACL,MAAC,KAAK,CAAC,QAAQ,eACZ,OAAO,IAAI,CACV,cAAK,SAAS,EAAC,0BAA0B,YAEvC,cAAK,SAAS,EAAC,qBAAqB,YACjC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,GACvC,GACF,CACP,EACA,IAAI,KATc,CAAC,CAAC,SAAS,CAUf,CAClB,CAAC;wBACJ,CAAC,CAAC,GACE,CACP,IACG,EAEL,CAAC,WAAW,GAAG,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAC1C,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,gBACG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,iCAAiC,CAAC,CAAC,CAAC,kBAAkB,EAClG,SAAS,EAAC,0EAA0E,EACpF,OAAO,EAAE,GAAG,EAAE;oBACZ,cAAc,EAAE,CAAC;oBACjB,gBAAgB,EAAE,EAAE,CAAC;gBACvB,CAAC,YAEA,WAAW,GAAG,CAAC;oBACd,CAAC,CAAC,GAAG,WAAW,eAAe,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI;oBAC7D,CAAC,CAAC,GAAG,GACA,CACV,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport type { ChatMessageV1, ModerationHandlers } from \"@ttt-productions/chat-core\";\nimport { isContinuation } from \"@ttt-productions/chat-core\";\nimport type { MessageRendererRegistry } from \"../types.js\";\nimport { Button } from \"@ttt-productions/ui-core/react\";\nimport { MessageItemDefault } from \"./MessageItemDefault.js\";\n\nexport function MessageList(props: {\n messages: ChatMessageV1[];\n currentUserId: string;\n isAdmin: boolean;\n\n isFetchingOlder?: boolean;\n hasOlder?: boolean;\n onLoadOlder?: () => void;\n\n renderMessage?: (m: ChatMessageV1) => React.ReactNode;\n messageRenderers?: MessageRendererRegistry;\n\n showScrollToBottom?: boolean;\n onScrollToBottom?: () => void;\n /** Reports whether the list is scrolled to the bottom so the consumer can advance\n * authoritative read state only when the latest message is actually in view (C-B6). */\n onAtBottomChange?: (atBottom: boolean) => void;\n /** Class for the scrollable message region. Overrides the default. The default is\n * `h-[400px]` (fixed-height card) unless `fillHeight` is set, in which case it is\n * `flex-1 min-h-0`. */\n scrollClassName?: string;\n /** Fill the parent's height instead of a fixed `h-[400px]`. Makes the list a flex-col\n * that flexes to fill its container, so a bounded-height page panel scrolls inside.\n * The consuming layout must give MessageList's ancestor a bounded height (ChatShell's\n * `fillHeight` wires Card → CardContent → MessageList for this). */\n fillHeight?: boolean;\n\n handlers?: ModerationHandlers;\n onSenderClick?: (senderId: string, displayName: string) => void;\n /** Retry a failed realtime send by clientMessageId (realtime transport only). */\n onRetrySend?: (clientMessageId: string) => void;\n /** Re-open the attachment picker for a terminally-failed attachment. Present only\n * when attachment support is configured; forwarded to each MessageItemDefault. */\n onRetryAttachment?: () => void;\n}) {\n const {\n messages,\n currentUserId,\n isAdmin,\n isFetchingOlder,\n hasOlder,\n onLoadOlder,\n renderMessage,\n messageRenderers,\n showScrollToBottom,\n onScrollToBottom,\n onAtBottomChange,\n scrollClassName,\n fillHeight = false,\n handlers,\n onSenderClick,\n onRetrySend,\n onRetryAttachment,\n } = props;\n\n const scrollClass = scrollClassName ?? (fillHeight ? \"flex-1 min-h-0\" : \"h-[400px]\");\n const outerClass = fillHeight ? \"relative flex flex-col flex-1 min-h-0\" : \"relative\";\n\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const topSentinelRef = React.useRef<HTMLDivElement>(null);\n\n const isAtBottomRef = React.useRef(true);\n const prevScrollHeightRef = React.useRef<number | null>(null);\n const prevCountRef = React.useRef(0);\n\n // Count of messages that arrived while the user was scrolled up — drives the\n // \"new messages\" pill. Reset when the user returns to the bottom.\n const [unseenCount, setUnseenCount] = React.useState(0);\n\n const scrollToBottom = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n el.scrollTop = el.scrollHeight;\n isAtBottomRef.current = true;\n setUnseenCount(0);\n onAtBottomChange?.(true);\n }, [onAtBottomChange]);\n\n // IntersectionObserver for infinite scroll (older messages)\n React.useEffect(() => {\n const root = scrollRef.current;\n const target = topSentinelRef.current;\n if (!root || !target) return;\n if (typeof IntersectionObserver === \"undefined\") return;\n\n const io = new IntersectionObserver(\n (entries) => {\n const e = entries[0];\n if (!e?.isIntersecting) return;\n if (!hasOlder || isFetchingOlder) return;\n\n prevScrollHeightRef.current = root.scrollHeight;\n onLoadOlder?.();\n },\n { root, threshold: 0 }\n );\n\n io.observe(target);\n return () => io.disconnect();\n }, [hasOlder, isFetchingOlder, onLoadOlder]);\n\n // Scroll management — FIXES accordion scroll jump\n React.useLayoutEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n\n const count = messages.length;\n const prev = prevCountRef.current;\n\n if (prev === 0 && count > 0) {\n // Initial load — scroll to bottom WITHOUT triggering parent scroll\n requestAnimationFrame(() => {\n const savedScrollY = window.scrollY;\n el.scrollTop = el.scrollHeight;\n // Restore page scroll if the browser moved it\n if (window.scrollY !== savedScrollY) {\n window.scrollTo({ top: savedScrollY, behavior: \"instant\" as ScrollBehavior });\n }\n });\n isAtBottomRef.current = true;\n } else if (count > prev && prevScrollHeightRef.current != null) {\n // Older messages prepended — maintain scroll position\n const diff = el.scrollHeight - prevScrollHeightRef.current;\n el.scrollTop += diff;\n prevScrollHeightRef.current = null;\n } else if (count > prev && isAtBottomRef.current) {\n // New message at bottom, user is at bottom — scroll down\n // Use scrollTop assignment, NOT scrollTo with behavior:\"smooth\" (causes parent scroll jump)\n requestAnimationFrame(() => {\n const savedScrollY = window.scrollY;\n el.scrollTop = el.scrollHeight;\n if (window.scrollY !== savedScrollY) {\n window.scrollTo({ top: savedScrollY, behavior: \"instant\" as ScrollBehavior });\n }\n });\n } else if (count > prev) {\n // New message(s) arrived while the user was scrolled up — surface the pill\n // instead of yanking their scroll position.\n setUnseenCount((c) => c + (count - prev));\n }\n\n prevCountRef.current = count;\n }, [messages]);\n\n const onScroll = (e: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;\n const atBottom = scrollHeight - (scrollTop + clientHeight) < 50;\n if (atBottom !== isAtBottomRef.current) onAtBottomChange?.(atBottom);\n isAtBottomRef.current = atBottom;\n if (atBottom && unseenCount !== 0) setUnseenCount(0);\n };\n\n let lastDay: string | null = null;\n\n return (\n <div className={outerClass}>\n <div ref={scrollRef} className={`${scrollClass} overflow-y-auto p-4`} onScroll={onScroll}>\n {isFetchingOlder && <div className=\"text-center text-xs opacity-70 mb-2\">Loading…</div>}\n\n <div ref={topSentinelRef} />\n\n {messages.length === 0 ? (\n <div className=\"h-full flex items-center justify-center text-sm opacity-70\">No messages yet</div>\n ) : (\n <div className=\"flex flex-col\">\n {messages.map((m, idx) => {\n const day = new Date(m.createdAt).toDateString();\n const showDay = day !== lastDay;\n lastDay = day;\n\n const prevMsg = idx > 0 ? messages[idx - 1] : undefined;\n // Date separators always break grouping\n const continuation = showDay ? false : isContinuation(prevMsg, m);\n\n const byType =\n m.type && messageRenderers?.[m.type] ? messageRenderers[m.type]!(m) : null;\n\n const body =\n renderMessage?.(m) ??\n byType ?? (\n <MessageItemDefault\n m={m}\n currentUserId={currentUserId}\n isAdmin={isAdmin}\n handlers={handlers}\n isContinuation={continuation}\n onSenderClick={onSenderClick}\n onRetrySend={onRetrySend}\n onRetryAttachment={onRetryAttachment}\n />\n );\n\n return (\n <React.Fragment key={m.messageId}>\n {showDay && (\n <div className=\"my-2 flex justify-center\">\n {/* theme-core: components.css */}\n <div className=\"chat-date-separator\">\n {new Date(m.createdAt).toLocaleDateString()}\n </div>\n </div>\n )}\n {body}\n </React.Fragment>\n );\n })}\n </div>\n )}\n </div>\n\n {(unseenCount > 0 || showScrollToBottom) && (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n aria-label={unseenCount > 0 ? `${unseenCount} new messages, scroll to latest` : \"Scroll to latest\"}\n className=\"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full shadow-sm gap-1\"\n onClick={() => {\n scrollToBottom();\n onScrollToBottom?.();\n }}\n >\n {unseenCount > 0\n ? `${unseenCount} new message${unseenCount > 1 ? \"s\" : \"\"} ↓`\n : \"↓\"}\n </Button>\n )}\n </div>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/chat-react",
3
- "version": "0.12.9",
3
+ "version": "0.12.11",
4
4
  "description": "Chat React UI, hooks, and Firebase-client adapter for TTT Productions apps (realtime newest window + infinite older pagination)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,11 +61,11 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@ttt-productions/chat-core": "^0.10.2",
64
- "@ttt-productions/chat-schemas": "^0.9.2",
64
+ "@ttt-productions/chat-schemas": "^0.9.3",
65
65
  "@ttt-productions/realtime-core": "^0.1.3",
66
- "@ttt-productions/media-schemas": "^0.14.2",
67
- "@ttt-productions/ui-core": "^0.11.8",
68
- "@ttt-productions/file-input": "^0.11.5",
66
+ "@ttt-productions/media-schemas": "^0.14.3",
67
+ "@ttt-productions/ui-core": "^0.11.10",
68
+ "@ttt-productions/file-input": "^0.11.6",
69
69
  "@ttt-productions/upload-ui": "^0.7.5",
70
70
  "@ttt-productions/media-viewer": "^0.10.5",
71
71
  "@ttt-productions/mobile-core": "^0.9.1",
@@ -97,16 +97,55 @@
97
97
  }
98
98
 
99
99
  /* --- Attachment states --- */
100
+
101
+ /* Pending / URL-settling placeholder. Parchment-safe: a lightly tinted surface
102
+ with a subtle tokenized border (NOT the old opaque muted slab, which read as a
103
+ dark rectangle on the parchment chat canvas). It is a small inline status row —
104
+ deliberately NOT a media-sized box, so it never implies the file is viewable.
105
+ All colors are theme tokens; a restrained shimmer conveys "in progress". */
100
106
  .chat-attachment-pending {
107
+ position: relative;
108
+ overflow: hidden;
101
109
  display: flex;
102
110
  align-items: center;
103
111
  gap: 0.5rem;
104
112
  padding: 0.5rem 0.75rem;
105
113
  border-radius: 0.375rem;
106
- background-color: hsl(var(--muted));
114
+ background-color: hsl(var(--muted) / 0.2);
115
+ border: 1px solid hsl(var(--border) / 0.6);
116
+ color: hsl(var(--muted-foreground));
107
117
  font-size: 0.75rem;
108
118
  }
109
119
 
120
+ /* Restrained left-to-right shimmer over the tinted surface. Tokenized, low-opacity,
121
+ and disabled under prefers-reduced-motion. The spinner remains the primary cue. */
122
+ .chat-attachment-pending::after {
123
+ content: "";
124
+ position: absolute;
125
+ inset: 0;
126
+ background: linear-gradient(
127
+ 90deg,
128
+ transparent 0%,
129
+ hsl(var(--muted-foreground) / 0.06) 50%,
130
+ transparent 100%
131
+ );
132
+ transform: translateX(-100%);
133
+ animation: chat-attachment-shimmer 1.8s ease-in-out infinite;
134
+ pointer-events: none;
135
+ }
136
+
137
+ @keyframes chat-attachment-shimmer {
138
+ 100% {
139
+ transform: translateX(100%);
140
+ }
141
+ }
142
+
143
+ @media (prefers-reduced-motion: reduce) {
144
+ .chat-attachment-pending::after {
145
+ animation: none;
146
+ }
147
+ }
148
+
110
149
  .chat-attachment-media {
111
150
  max-width: 320px;
112
151
  border-radius: 0.375rem;
@@ -130,17 +169,42 @@
130
169
  opacity: 0.8;
131
170
  }
132
171
 
172
+ /* Terminal-failure placeholder. A restrained, tokenized surface — a subtle border
173
+ and faint muted tint, NOT a destructive-red block (the failure is localized to
174
+ this attachment, so it must not make the whole bubble read as an error). */
133
175
  .chat-attachment-rejected {
134
176
  display: flex;
135
- align-items: center;
136
- gap: 0.375rem;
177
+ align-items: flex-start;
178
+ gap: 0.5rem;
137
179
  padding: 0.5rem 0.75rem;
138
180
  border-radius: 0.375rem;
139
- background-color: hsl(var(--warning, var(--muted)) / 0.15);
140
- color: hsl(var(--warning-foreground, var(--muted-foreground)));
181
+ background-color: hsl(var(--muted) / 0.35);
182
+ border: 1px solid hsl(var(--border));
183
+ color: hsl(var(--muted-foreground));
141
184
  font-size: 0.75rem;
142
185
  }
143
186
 
187
+ .chat-attachment-rejected-icon {
188
+ margin-top: 0.05rem;
189
+ color: hsl(var(--muted-foreground));
190
+ }
191
+
192
+ .chat-attachment-rejected-body {
193
+ display: flex;
194
+ flex-direction: column;
195
+ gap: 0.05rem;
196
+ min-width: 0;
197
+ }
198
+
199
+ .chat-attachment-rejected-reason {
200
+ opacity: 0.85;
201
+ }
202
+
203
+ .chat-attachment-retry {
204
+ margin-left: auto;
205
+ flex-shrink: 0;
206
+ }
207
+
144
208
  .chat-attachment-status-label {
145
209
  margin-left: auto;
146
210
  opacity: 0.7;