@danxbot/ui 15.24.0 → 15.25.1
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.js +7675 -7506
- package/dist/index.js.map +1 -1
- package/dist/types/components/VideoPlayer.d.ts +26 -0
- package/dist/types/components/chat/Attachment.d.ts +11 -5
- package/dist/types/components/chat/FileCover.d.ts +14 -0
- package/dist/types/components/chat/file-icon.d.ts +21 -0
- package/dist/types/components/media-error.d.ts +11 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
export interface VideoTrack {
|
|
3
|
+
/** URL of a WebVTT file. */
|
|
4
|
+
src: string;
|
|
5
|
+
/** Shown in the browser's caption menu — "English". */
|
|
6
|
+
label: string;
|
|
7
|
+
/** BCP-47 language tag — "en". */
|
|
8
|
+
srcLang: string;
|
|
9
|
+
default?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface VideoPlayerProps {
|
|
12
|
+
src: string;
|
|
13
|
+
/** The accessible name of the player — usually the file name. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** A still shown until playback starts. */
|
|
16
|
+
poster?: string;
|
|
17
|
+
muted?: boolean;
|
|
18
|
+
/** Caption tracks. Rendered as `kind="captions"`. */
|
|
19
|
+
tracks?: VideoTrack[];
|
|
20
|
+
/** When passed, the can't-play fallback offers a Download button that calls it. */
|
|
21
|
+
onDownload?: () => void;
|
|
22
|
+
/** Sizes the player's frame. A `max-h-*` here caps the video, which then letterboxes. */
|
|
23
|
+
className?: string;
|
|
24
|
+
ref?: Ref<HTMLDivElement>;
|
|
25
|
+
}
|
|
26
|
+
export declare function VideoPlayer({ src, title, poster, muted, tracks, onDownload, className, ref, }: VideoPlayerProps): import("react").JSX.Element;
|
|
@@ -93,11 +93,17 @@ export interface AttachmentPreviewProps {
|
|
|
93
93
|
/**
|
|
94
94
|
* A file, opened.
|
|
95
95
|
*
|
|
96
|
-
* Deliberately narrow about what it displays: images, and anything the
|
|
97
|
-
* consumer hands it through `renderBody`. It does NOT attempt to preview PDFs
|
|
98
|
-
* office documents
|
|
99
|
-
*
|
|
100
|
-
*
|
|
96
|
+
* Deliberately narrow about what it displays: images, video, and anything the
|
|
97
|
+
* consumer hands it through `renderBody`. It does NOT attempt to preview PDFs
|
|
98
|
+
* or office documents by embedding them — an iframe pointed at an arbitrary
|
|
99
|
+
* attachment is a security surface, and a half-working preview is worse than an
|
|
100
|
+
* honest "open it" because people trust what they see.
|
|
101
|
+
*
|
|
102
|
+
* VIDEO IS NOT THAT SURFACE. A native `<video>` (through `VideoPlayer`) is the
|
|
103
|
+
* browser decoding a media stream inside its own sandbox, not a document
|
|
104
|
+
* embedded from elsewhere, so it is allowed where an iframe or <object> is not.
|
|
105
|
+
* Video is recognised by mime type OR extension, because attachments from chat
|
|
106
|
+
* integrations arrive as `application/octet-stream`.
|
|
101
107
|
*/
|
|
102
108
|
export declare function AttachmentPreview({ file, onOpenChange, onDownload, renderBody, }: AttachmentPreviewProps): import("react").JSX.Element;
|
|
103
109
|
export interface AttachmentListProps {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
import type { ChatFile } from "./types";
|
|
3
|
+
export interface FileCoverProps {
|
|
4
|
+
file: ChatFile;
|
|
5
|
+
/** CSS `aspect-ratio` of the box. */
|
|
6
|
+
aspect?: number | string;
|
|
7
|
+
/** Alt text of an image cover. Defaults to the file name. */
|
|
8
|
+
alt?: string;
|
|
9
|
+
/** Offered by a video's can't-play fallback. */
|
|
10
|
+
onDownload?: (file: ChatFile) => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
export declare function FileCover({ file, aspect, alt, onDownload, className, ref, }: FileCoverProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IconName } from "../Icon";
|
|
2
|
+
import type { ChatFile } from "./types";
|
|
3
|
+
/** What a file is, before anyone decides what it looks like. */
|
|
4
|
+
export type FileKind = "image" | "video" | "audio" | "code" | "text" | "archive" | "table" | "file";
|
|
5
|
+
export type FileIdentity = Pick<ChatFile, "name" | "mimeType">;
|
|
6
|
+
/**
|
|
7
|
+
* What a file is, from its mime type and, when that says nothing, its
|
|
8
|
+
* extension.
|
|
9
|
+
*
|
|
10
|
+
* No mime type is normal — a file dragged from some sources arrives without
|
|
11
|
+
* one, and chat integrations send `application/octet-stream` for everything.
|
|
12
|
+
* The extension is the next best signal, and guessing from it beats a generic
|
|
13
|
+
* icon for the formats people actually attach.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fileKindOf(file: FileIdentity): FileKind;
|
|
16
|
+
/** The icon a kind of file wears when it has no picture. */
|
|
17
|
+
export declare const fileKindIcon: (kind: FileKind) => IconName;
|
|
18
|
+
/** The icon for a file. */
|
|
19
|
+
export declare const fileIconFor: (file: FileIdentity) => IconName;
|
|
20
|
+
export declare const isImageFile: (file: FileIdentity) => boolean;
|
|
21
|
+
export declare const isVideoFile: (file: FileIdentity) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ref callback that reports a media element which had ALREADY failed when
|
|
3
|
+
* React committed it. DX-3982.
|
|
4
|
+
*
|
|
5
|
+
* A source the browser rejects at once fails BEFORE React commits the element,
|
|
6
|
+
* and React drops an event for an uncommitted node — so `onError` never runs
|
|
7
|
+
* and the element sits at 0:00 forever. The element's own `error` is the
|
|
8
|
+
* record of that, read at commit. Pair it with `onError` for failures that
|
|
9
|
+
* arrive after.
|
|
10
|
+
*/
|
|
11
|
+
export declare const reportCommittedError: (onFailed: () => void) => (el: HTMLMediaElement | null) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -108,6 +108,9 @@ export { MessageScroller, type MessageScrollerProps, } from "./components/chat/M
|
|
|
108
108
|
export { Composer, type ComposerProps } from "./components/chat/Composer";
|
|
109
109
|
export { StreamingMarkdown, type StreamingMarkdownProps, } from "./components/chat/StreamingMarkdown";
|
|
110
110
|
export { Attachment, AttachmentAction, AttachmentList, AttachmentPreview, type AttachmentProps, type AttachmentActionProps, type AttachmentListProps, type AttachmentPreviewProps, type AttachmentLayout, } from "./components/chat/Attachment";
|
|
111
|
+
export { FileCover, type FileCoverProps } from "./components/chat/FileCover";
|
|
112
|
+
export { fileIconFor, type FileIdentity } from "./components/chat/file-icon";
|
|
113
|
+
export { VideoPlayer, type VideoPlayerProps, type VideoTrack } from "./components/VideoPlayer";
|
|
111
114
|
export { ModelSelector, type ModelSelectorProps, type ChatModel, } from "./components/chat/ModelSelector";
|
|
112
115
|
export { EffortControl, DEFAULT_EFFORT_LEVELS, type EffortControlProps, type EffortLevel, } from "./components/chat/EffortControl";
|
|
113
116
|
export { ContextMeter, ChatStatus, type ContextMeterProps, type ContextSegment, type UsageLimit, type ChatStatusProps, } from "./components/chat/ContextMeter";
|