@ai-matrx/media 0.2.0 → 0.2.2
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/CHANGELOG.md +36 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/react.cjs +15 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +30 -3
- package/dist/react.d.ts +30 -3
- package/dist/react.js +15 -4
- package/dist/react.js.map +1 -1
- package/package.json +2 -2
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { SVGProps, HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { MediaRefLike, MediaUploadOptions, MediaActionKind } from './index.cjs';
|
|
3
|
+
import { MediaRefLike, DurableSrc, MediaUploadOptions, MediaActionKind } from './index.cjs';
|
|
4
4
|
import { M as MediaUploadEntry } from './use-media-upload-v5Uq9Ruq.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -142,6 +142,18 @@ interface InlineMediaRefProps {
|
|
|
142
142
|
preload?: "none" | "metadata" | "auto" | undefined;
|
|
143
143
|
/** Space-separated native controls to hide — forwarded to `<video controlsList>`. */
|
|
144
144
|
controlsList?: string | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Poster frame forwarded to `<video poster>`. Takes the branded
|
|
147
|
+
* {@link DurableSrc} only (law 3) — the host resolves/mints it, exactly
|
|
148
|
+
* like the element `src`; there is no raw-string lane.
|
|
149
|
+
*/
|
|
150
|
+
poster?: DurableSrc | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Label reported to the host's playback-session port while this element
|
|
153
|
+
* plays (e.g. "Video (fullscreen)" in a lightbox). Default: `alt`, then
|
|
154
|
+
* "Media file".
|
|
155
|
+
*/
|
|
156
|
+
playbackLabel?: string | undefined;
|
|
145
157
|
rounded?: "none" | "sm" | "md" | "lg" | "full" | undefined;
|
|
146
158
|
/** Click handler — wires up cursor + role + keyboard activation. */
|
|
147
159
|
onClick?: ((event: react__default.MouseEvent | react__default.KeyboardEvent) => void) | undefined;
|
|
@@ -168,7 +180,7 @@ interface InlineMediaRefProps {
|
|
|
168
180
|
border?: "none" | "subtle" | undefined;
|
|
169
181
|
className?: string | undefined;
|
|
170
182
|
}
|
|
171
|
-
declare function InlineMediaRef({ ref: mediaRef, size, fit, fallback, fallbackIcon, errorFallback, alt, as, controls, autoPlay, loop, muted, playsInline, preload, controlsList, rounded, onClick, onError, onLoad, mediaElementRef, crossOrigin, border, className, }: InlineMediaRefProps): react__default.JSX.Element | null;
|
|
183
|
+
declare function InlineMediaRef({ ref: mediaRef, size, fit, fallback, fallbackIcon, errorFallback, alt, as, controls, autoPlay, loop, muted, playsInline, preload, controlsList, poster, playbackLabel, rounded, onClick, onError, onLoad, mediaElementRef, crossOrigin, border, className, }: InlineMediaRefProps): react__default.JSX.Element | null;
|
|
172
184
|
|
|
173
185
|
interface MediaThumbnailProps {
|
|
174
186
|
/** The file's durable ref (a MediaRef or bare fileId). */
|
|
@@ -304,6 +316,21 @@ interface MediaLightboxProps {
|
|
|
304
316
|
alt?: string | undefined;
|
|
305
317
|
/** Force the media element type (default: inferred from the resolution). */
|
|
306
318
|
as?: "img" | "video" | "audio" | undefined;
|
|
319
|
+
/** Start video/audio playback on open — forwarded to the media element. */
|
|
320
|
+
autoPlay?: boolean | undefined;
|
|
321
|
+
/** Inline (non-fullscreen-hijack) playback on iOS — forwarded to `<video>`. */
|
|
322
|
+
playsInline?: boolean | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Poster frame for video — the branded {@link DurableSrc} only (law 3),
|
|
325
|
+
* resolved/minted by the host exactly like the element src.
|
|
326
|
+
*/
|
|
327
|
+
poster?: DurableSrc | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Playback-session label reported to the host's `playbackSession` port
|
|
330
|
+
* while the media plays (e.g. "Video (fullscreen)"). Rides the existing
|
|
331
|
+
* port — no new playback lane.
|
|
332
|
+
*/
|
|
333
|
+
playbackLabel?: string | undefined;
|
|
307
334
|
/** Toolbar actions to offer. Default: share, download, copy, open. */
|
|
308
335
|
actions?: MediaActionKind[] | undefined;
|
|
309
336
|
/** Hide unavailable toolbar actions instead of disabling them. */
|
|
@@ -312,6 +339,6 @@ interface MediaLightboxProps {
|
|
|
312
339
|
headerExtra?: ReactNode | undefined;
|
|
313
340
|
className?: string | undefined;
|
|
314
341
|
}
|
|
315
|
-
declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
|
|
342
|
+
declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, autoPlay, playsInline, poster, playbackLabel, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
|
|
316
343
|
|
|
317
344
|
export { AlertCircleIcon, ArchiveIcon, BracesIcon, CheckCircle2Icon, CheckIcon, CodeIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, FileAudioIcon, FileCodeIcon, FileIcon, type FileIconProps, FileJsonIcon, FileSpreadsheetIcon, FileTextIcon, FileTypeIcon, FileUploadDropzone, type FileUploadDropzoneActions, type FileUploadDropzoneProps, FileVideoIcon, FolderIcon, FolderOpenIcon, GlobeIcon, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, Link2Icon, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PenToolIcon, PlusIcon, SearchIcon, Settings2Icon, Share2Icon, SpinnerIcon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, formatFileSize, useMediaDropzone };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { SVGProps, HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { MediaRefLike, MediaUploadOptions, MediaActionKind } from './index.js';
|
|
3
|
+
import { MediaRefLike, DurableSrc, MediaUploadOptions, MediaActionKind } from './index.js';
|
|
4
4
|
import { M as MediaUploadEntry } from './use-media-upload-Dg2HSvTq.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -142,6 +142,18 @@ interface InlineMediaRefProps {
|
|
|
142
142
|
preload?: "none" | "metadata" | "auto" | undefined;
|
|
143
143
|
/** Space-separated native controls to hide — forwarded to `<video controlsList>`. */
|
|
144
144
|
controlsList?: string | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Poster frame forwarded to `<video poster>`. Takes the branded
|
|
147
|
+
* {@link DurableSrc} only (law 3) — the host resolves/mints it, exactly
|
|
148
|
+
* like the element `src`; there is no raw-string lane.
|
|
149
|
+
*/
|
|
150
|
+
poster?: DurableSrc | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Label reported to the host's playback-session port while this element
|
|
153
|
+
* plays (e.g. "Video (fullscreen)" in a lightbox). Default: `alt`, then
|
|
154
|
+
* "Media file".
|
|
155
|
+
*/
|
|
156
|
+
playbackLabel?: string | undefined;
|
|
145
157
|
rounded?: "none" | "sm" | "md" | "lg" | "full" | undefined;
|
|
146
158
|
/** Click handler — wires up cursor + role + keyboard activation. */
|
|
147
159
|
onClick?: ((event: react__default.MouseEvent | react__default.KeyboardEvent) => void) | undefined;
|
|
@@ -168,7 +180,7 @@ interface InlineMediaRefProps {
|
|
|
168
180
|
border?: "none" | "subtle" | undefined;
|
|
169
181
|
className?: string | undefined;
|
|
170
182
|
}
|
|
171
|
-
declare function InlineMediaRef({ ref: mediaRef, size, fit, fallback, fallbackIcon, errorFallback, alt, as, controls, autoPlay, loop, muted, playsInline, preload, controlsList, rounded, onClick, onError, onLoad, mediaElementRef, crossOrigin, border, className, }: InlineMediaRefProps): react__default.JSX.Element | null;
|
|
183
|
+
declare function InlineMediaRef({ ref: mediaRef, size, fit, fallback, fallbackIcon, errorFallback, alt, as, controls, autoPlay, loop, muted, playsInline, preload, controlsList, poster, playbackLabel, rounded, onClick, onError, onLoad, mediaElementRef, crossOrigin, border, className, }: InlineMediaRefProps): react__default.JSX.Element | null;
|
|
172
184
|
|
|
173
185
|
interface MediaThumbnailProps {
|
|
174
186
|
/** The file's durable ref (a MediaRef or bare fileId). */
|
|
@@ -304,6 +316,21 @@ interface MediaLightboxProps {
|
|
|
304
316
|
alt?: string | undefined;
|
|
305
317
|
/** Force the media element type (default: inferred from the resolution). */
|
|
306
318
|
as?: "img" | "video" | "audio" | undefined;
|
|
319
|
+
/** Start video/audio playback on open — forwarded to the media element. */
|
|
320
|
+
autoPlay?: boolean | undefined;
|
|
321
|
+
/** Inline (non-fullscreen-hijack) playback on iOS — forwarded to `<video>`. */
|
|
322
|
+
playsInline?: boolean | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Poster frame for video — the branded {@link DurableSrc} only (law 3),
|
|
325
|
+
* resolved/minted by the host exactly like the element src.
|
|
326
|
+
*/
|
|
327
|
+
poster?: DurableSrc | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Playback-session label reported to the host's `playbackSession` port
|
|
330
|
+
* while the media plays (e.g. "Video (fullscreen)"). Rides the existing
|
|
331
|
+
* port — no new playback lane.
|
|
332
|
+
*/
|
|
333
|
+
playbackLabel?: string | undefined;
|
|
307
334
|
/** Toolbar actions to offer. Default: share, download, copy, open. */
|
|
308
335
|
actions?: MediaActionKind[] | undefined;
|
|
309
336
|
/** Hide unavailable toolbar actions instead of disabling them. */
|
|
@@ -312,6 +339,6 @@ interface MediaLightboxProps {
|
|
|
312
339
|
headerExtra?: ReactNode | undefined;
|
|
313
340
|
className?: string | undefined;
|
|
314
341
|
}
|
|
315
|
-
declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
|
|
342
|
+
declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, autoPlay, playsInline, poster, playbackLabel, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
|
|
316
343
|
|
|
317
344
|
export { AlertCircleIcon, ArchiveIcon, BracesIcon, CheckCircle2Icon, CheckIcon, CodeIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, FileAudioIcon, FileCodeIcon, FileIcon, type FileIconProps, FileJsonIcon, FileSpreadsheetIcon, FileTextIcon, FileTypeIcon, FileUploadDropzone, type FileUploadDropzoneActions, type FileUploadDropzoneProps, FileVideoIcon, FolderIcon, FolderOpenIcon, GlobeIcon, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, Link2Icon, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PenToolIcon, PlusIcon, SearchIcon, Settings2Icon, Share2Icon, SpinnerIcon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, formatFileSize, useMediaDropzone };
|
package/dist/react.js
CHANGED
|
@@ -876,6 +876,8 @@ function InlineMediaRef({
|
|
|
876
876
|
playsInline,
|
|
877
877
|
preload,
|
|
878
878
|
controlsList,
|
|
879
|
+
poster,
|
|
880
|
+
playbackLabel,
|
|
879
881
|
rounded = "md",
|
|
880
882
|
onClick,
|
|
881
883
|
onError,
|
|
@@ -919,7 +921,7 @@ function InlineMediaRef({
|
|
|
919
921
|
{
|
|
920
922
|
isPlaying: isMediaPlaying,
|
|
921
923
|
source: "file-media",
|
|
922
|
-
label: alt || "Media file",
|
|
924
|
+
label: playbackLabel ?? (alt || "Media file"),
|
|
923
925
|
trackKey
|
|
924
926
|
},
|
|
925
927
|
sessionElRef
|
|
@@ -1060,6 +1062,7 @@ function InlineMediaRef({
|
|
|
1060
1062
|
playsInline,
|
|
1061
1063
|
preload,
|
|
1062
1064
|
controlsList,
|
|
1065
|
+
poster,
|
|
1063
1066
|
onLoadedData: onLoad,
|
|
1064
1067
|
onError: handleLoadError,
|
|
1065
1068
|
crossOrigin,
|
|
@@ -1142,7 +1145,7 @@ function useThumbnailSource(ref, options = {}) {
|
|
|
1142
1145
|
return null;
|
|
1143
1146
|
}
|
|
1144
1147
|
}, [client, thumbnailUrl]);
|
|
1145
|
-
const needsBlob = allowSourceFallback && !explicitThumb && !resolution?.thumbnailSrc && resolution?.transport === "blob";
|
|
1148
|
+
const needsBlob = allowSourceFallback && !explicitThumb && !resolution?.thumbnailSrc && resolution?.transport === "blob" && (resolution.kind === "image" || resolution.kind === "video");
|
|
1146
1149
|
const blob = useMediaBlob(needsBlob ? ref : null);
|
|
1147
1150
|
if (explicitThumb) {
|
|
1148
1151
|
return {
|
|
@@ -1263,7 +1266,7 @@ function ImageThumb({
|
|
|
1263
1266
|
{
|
|
1264
1267
|
src: url,
|
|
1265
1268
|
alt,
|
|
1266
|
-
loading: "lazy",
|
|
1269
|
+
loading: url.startsWith("blob:") ? "eager" : "lazy",
|
|
1267
1270
|
className: "h-full w-full object-cover",
|
|
1268
1271
|
onError: onLoadError
|
|
1269
1272
|
},
|
|
@@ -2024,6 +2027,10 @@ function MediaLightbox({
|
|
|
2024
2027
|
fileName,
|
|
2025
2028
|
alt,
|
|
2026
2029
|
as,
|
|
2030
|
+
autoPlay,
|
|
2031
|
+
playsInline,
|
|
2032
|
+
poster,
|
|
2033
|
+
playbackLabel,
|
|
2027
2034
|
actions,
|
|
2028
2035
|
hideUnavailableActions = false,
|
|
2029
2036
|
headerExtra,
|
|
@@ -2102,7 +2109,11 @@ function MediaLightbox({
|
|
|
2102
2109
|
fit: "contain",
|
|
2103
2110
|
rounded: "none",
|
|
2104
2111
|
alt: alt ?? fileName ?? "",
|
|
2105
|
-
as
|
|
2112
|
+
as,
|
|
2113
|
+
autoPlay,
|
|
2114
|
+
playsInline,
|
|
2115
|
+
poster,
|
|
2116
|
+
playbackLabel
|
|
2106
2117
|
}
|
|
2107
2118
|
) })
|
|
2108
2119
|
}
|