@ttt-productions/chat-react 0.12.11 → 0.12.12
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,15 +1,28 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { MediaPreviewProps } from "@ttt-productions/media-viewer";
|
|
2
|
+
import type { MediaPreviewProps, MediaViewerType } from "@ttt-productions/media-viewer";
|
|
3
|
+
import type { ChatAttachment } from "@ttt-productions/chat-core";
|
|
3
4
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* MediaPreview props.
|
|
5
|
+
* The media kinds chat actually renders through the injected component. Chat only ever
|
|
6
|
+
* mounts it for image/video/audio attachments; text/markdown render as the package's own
|
|
7
|
+
* download link and never reach this slot. Computed as the intersection of chat-core's
|
|
8
|
+
* `ChatAttachment['type']` and media-viewer's `MediaViewerType`, so it stays in the chat +
|
|
9
|
+
* media-viewer domains with no ttt-core dependency (ARCH-201) and tracks either union
|
|
10
|
+
* automatically if a kind is added or removed.
|
|
11
11
|
*/
|
|
12
|
-
export type
|
|
12
|
+
export type ChatAttachmentMediaKind = Extract<ChatAttachment["type"], MediaViewerType>;
|
|
13
|
+
/**
|
|
14
|
+
* The component chat attachments render their media through. Defaults to the bare
|
|
15
|
+
* media-viewer `MediaViewer` when no provider is present; the consuming app injects its own
|
|
16
|
+
* wrapper (recovery adapter, diagnostics, telemetry — whatever the app's one display path
|
|
17
|
+
* adds) so chat media rides the SAME display pipeline as every other surface. chat-react
|
|
18
|
+
* stays app-agnostic: it renders whatever component it is handed with plain MediaPreview
|
|
19
|
+
* props — except `type`, which is REQUIRED and narrowed to the kind chat provides, so the
|
|
20
|
+
* consuming wrapper never has to narrow an all-optional classification (no dead
|
|
21
|
+
* mime/name/'other' branch).
|
|
22
|
+
*/
|
|
23
|
+
export type ChatAttachmentMediaComponent = React.ComponentType<Omit<MediaPreviewProps, "type"> & {
|
|
24
|
+
type: ChatAttachmentMediaKind;
|
|
25
|
+
}>;
|
|
13
26
|
export type ChatAttachmentMediaProviderProps = {
|
|
14
27
|
mediaComponent: ChatAttachmentMediaComponent;
|
|
15
28
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatAttachmentMediaContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatAttachmentMediaContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatAttachmentMediaContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatAttachmentMediaContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC;AAEvF;;;;;;;;;GASG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAAC,aAAa,CAC5D,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,uBAAuB,CAAA;CAAE,CACpE,CAAC;AAIF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,4BAA4B,CAAC;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,qBAOlF;AAED,sEAAsE;AACtE,wBAAgB,+BAA+B,IAAI,4BAA4B,GAAG,IAAI,CAErF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatAttachmentMediaContext.js","sourceRoot":"","sources":["../../src/context/ChatAttachmentMediaContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatAttachmentMediaContext.js","sourceRoot":"","sources":["../../src/context/ChatAttachmentMediaContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,MAAM,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAAsC,IAAI,CAAC,CAAC;AAOlG;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAuC;IACjF,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3C,OAAO,CACL,KAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YACvD,QAAQ,GAC2B,CACvC,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,+BAA+B;IAC7C,OAAO,KAAK,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;AACtD,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport type { MediaPreviewProps, MediaViewerType } from \"@ttt-productions/media-viewer\";\nimport type { ChatAttachment } from \"@ttt-productions/chat-core\";\n\n/**\n * The media kinds chat actually renders through the injected component. Chat only ever\n * mounts it for image/video/audio attachments; text/markdown render as the package's own\n * download link and never reach this slot. Computed as the intersection of chat-core's\n * `ChatAttachment['type']` and media-viewer's `MediaViewerType`, so it stays in the chat +\n * media-viewer domains with no ttt-core dependency (ARCH-201) and tracks either union\n * automatically if a kind is added or removed.\n */\nexport type ChatAttachmentMediaKind = Extract<ChatAttachment[\"type\"], MediaViewerType>;\n\n/**\n * The component chat attachments render their media through. Defaults to the bare\n * media-viewer `MediaViewer` when no provider is present; the consuming app injects its own\n * wrapper (recovery adapter, diagnostics, telemetry — whatever the app's one display path\n * adds) so chat media rides the SAME display pipeline as every other surface. chat-react\n * stays app-agnostic: it renders whatever component it is handed with plain MediaPreview\n * props — except `type`, which is REQUIRED and narrowed to the kind chat provides, so the\n * consuming wrapper never has to narrow an all-optional classification (no dead\n * mime/name/'other' branch).\n */\nexport type ChatAttachmentMediaComponent = React.ComponentType<\n Omit<MediaPreviewProps, \"type\"> & { type: ChatAttachmentMediaKind }\n>;\n\nconst ChatAttachmentMediaContext = React.createContext<ChatAttachmentMediaComponent | null>(null);\n\nexport type ChatAttachmentMediaProviderProps = {\n mediaComponent: ChatAttachmentMediaComponent;\n children: React.ReactNode;\n};\n\n/**\n * Optional (unlike ChatAttachmentUrlProvider, which is required): without it,\n * attachments render through the package's own MediaViewer exactly as before.\n */\nexport function ChatAttachmentMediaProvider(props: ChatAttachmentMediaProviderProps) {\n const { mediaComponent, children } = props;\n return (\n <ChatAttachmentMediaContext.Provider value={mediaComponent}>\n {children}\n </ChatAttachmentMediaContext.Provider>\n );\n}\n\n/** Nullable hook — consumers fall back to the package MediaViewer. */\nexport function useChatAttachmentMediaComponent(): ChatAttachmentMediaComponent | null {\n return React.useContext(ChatAttachmentMediaContext);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttt-productions/chat-react",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.12",
|
|
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",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@ttt-productions/ui-core": "^0.11.10",
|
|
68
68
|
"@ttt-productions/file-input": "^0.11.6",
|
|
69
69
|
"@ttt-productions/upload-ui": "^0.7.5",
|
|
70
|
-
"@ttt-productions/media-viewer": "^0.10.
|
|
70
|
+
"@ttt-productions/media-viewer": "^0.10.6",
|
|
71
71
|
"@ttt-productions/mobile-core": "^0.9.1",
|
|
72
|
-
"@ttt-productions/firebase-helpers": "^0.12.
|
|
72
|
+
"@ttt-productions/firebase-helpers": "^0.12.3"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@ttt-productions/query-core": "^0.14.1",
|