@ai-matrx/media 0.1.1 → 0.2.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/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
  /**
@@ -45,6 +45,12 @@ declare function VolumeXIcon(props: MediaIconProps): react.JSX.Element;
45
45
  declare function XIcon(props: MediaIconProps): react.JSX.Element;
46
46
  declare function AlertCircleIcon(props: MediaIconProps): react.JSX.Element;
47
47
  declare function CheckCircle2Icon(props: MediaIconProps): react.JSX.Element;
48
+ declare function GlobeIcon(props: MediaIconProps): react.JSX.Element;
49
+ declare function Link2Icon(props: MediaIconProps): react.JSX.Element;
50
+ declare function Settings2Icon(props: MediaIconProps): react.JSX.Element;
51
+ declare function SpinnerIcon(props: MediaIconProps): react.JSX.Element;
52
+ declare function PlusIcon(props: MediaIconProps): react.JSX.Element;
53
+ declare function SearchIcon(props: MediaIconProps): react.JSX.Element;
48
54
 
49
55
  /**
50
56
  * src/react/file-icon.tsx — icon tile for any file or folder.
@@ -136,6 +142,18 @@ interface InlineMediaRefProps {
136
142
  preload?: "none" | "metadata" | "auto" | undefined;
137
143
  /** Space-separated native controls to hide — forwarded to `<video controlsList>`. */
138
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;
139
157
  rounded?: "none" | "sm" | "md" | "lg" | "full" | undefined;
140
158
  /** Click handler — wires up cursor + role + keyboard activation. */
141
159
  onClick?: ((event: react__default.MouseEvent | react__default.KeyboardEvent) => void) | undefined;
@@ -162,7 +180,7 @@ interface InlineMediaRefProps {
162
180
  border?: "none" | "subtle" | undefined;
163
181
  className?: string | undefined;
164
182
  }
165
- 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;
166
184
 
167
185
  interface MediaThumbnailProps {
168
186
  /** The file's durable ref (a MediaRef or bare fileId). */
@@ -298,6 +316,21 @@ interface MediaLightboxProps {
298
316
  alt?: string | undefined;
299
317
  /** Force the media element type (default: inferred from the resolution). */
300
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;
301
334
  /** Toolbar actions to offer. Default: share, download, copy, open. */
302
335
  actions?: MediaActionKind[] | undefined;
303
336
  /** Hide unavailable toolbar actions instead of disabling them. */
@@ -306,6 +339,6 @@ interface MediaLightboxProps {
306
339
  headerExtra?: ReactNode | undefined;
307
340
  className?: string | undefined;
308
341
  }
309
- 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;
310
343
 
311
- 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, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PenToolIcon, Share2Icon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, formatFileSize, useMediaDropzone };
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
  /**
@@ -45,6 +45,12 @@ declare function VolumeXIcon(props: MediaIconProps): react.JSX.Element;
45
45
  declare function XIcon(props: MediaIconProps): react.JSX.Element;
46
46
  declare function AlertCircleIcon(props: MediaIconProps): react.JSX.Element;
47
47
  declare function CheckCircle2Icon(props: MediaIconProps): react.JSX.Element;
48
+ declare function GlobeIcon(props: MediaIconProps): react.JSX.Element;
49
+ declare function Link2Icon(props: MediaIconProps): react.JSX.Element;
50
+ declare function Settings2Icon(props: MediaIconProps): react.JSX.Element;
51
+ declare function SpinnerIcon(props: MediaIconProps): react.JSX.Element;
52
+ declare function PlusIcon(props: MediaIconProps): react.JSX.Element;
53
+ declare function SearchIcon(props: MediaIconProps): react.JSX.Element;
48
54
 
49
55
  /**
50
56
  * src/react/file-icon.tsx — icon tile for any file or folder.
@@ -136,6 +142,18 @@ interface InlineMediaRefProps {
136
142
  preload?: "none" | "metadata" | "auto" | undefined;
137
143
  /** Space-separated native controls to hide — forwarded to `<video controlsList>`. */
138
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;
139
157
  rounded?: "none" | "sm" | "md" | "lg" | "full" | undefined;
140
158
  /** Click handler — wires up cursor + role + keyboard activation. */
141
159
  onClick?: ((event: react__default.MouseEvent | react__default.KeyboardEvent) => void) | undefined;
@@ -162,7 +180,7 @@ interface InlineMediaRefProps {
162
180
  border?: "none" | "subtle" | undefined;
163
181
  className?: string | undefined;
164
182
  }
165
- 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;
166
184
 
167
185
  interface MediaThumbnailProps {
168
186
  /** The file's durable ref (a MediaRef or bare fileId). */
@@ -298,6 +316,21 @@ interface MediaLightboxProps {
298
316
  alt?: string | undefined;
299
317
  /** Force the media element type (default: inferred from the resolution). */
300
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;
301
334
  /** Toolbar actions to offer. Default: share, download, copy, open. */
302
335
  actions?: MediaActionKind[] | undefined;
303
336
  /** Hide unavailable toolbar actions instead of disabling them. */
@@ -306,6 +339,6 @@ interface MediaLightboxProps {
306
339
  headerExtra?: ReactNode | undefined;
307
340
  className?: string | undefined;
308
341
  }
309
- 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;
310
343
 
311
- 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, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PenToolIcon, Share2Icon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, formatFileSize, useMediaDropzone };
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
@@ -243,6 +243,43 @@ function CheckCircle2Icon(props) {
243
243
  /* @__PURE__ */ jsx("path", { d: "m9 11 3 3L22 4" })
244
244
  ] });
245
245
  }
246
+ function GlobeIcon(props) {
247
+ return /* @__PURE__ */ jsxs("svg", { ...svgProps(props), children: [
248
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
249
+ /* @__PURE__ */ jsx("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }),
250
+ /* @__PURE__ */ jsx("path", { d: "M2 12h20" })
251
+ ] });
252
+ }
253
+ function Link2Icon(props) {
254
+ return /* @__PURE__ */ jsxs("svg", { ...svgProps(props), children: [
255
+ /* @__PURE__ */ jsx("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }),
256
+ /* @__PURE__ */ jsx("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }),
257
+ /* @__PURE__ */ jsx("line", { x1: "8", x2: "16", y1: "12", y2: "12" })
258
+ ] });
259
+ }
260
+ function Settings2Icon(props) {
261
+ return /* @__PURE__ */ jsxs("svg", { ...svgProps(props), children: [
262
+ /* @__PURE__ */ jsx("path", { d: "M20 7h-9" }),
263
+ /* @__PURE__ */ jsx("path", { d: "M14 17H5" }),
264
+ /* @__PURE__ */ jsx("circle", { cx: "17", cy: "17", r: "3" }),
265
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "3" })
266
+ ] });
267
+ }
268
+ function SpinnerIcon(props) {
269
+ return /* @__PURE__ */ jsx("svg", { ...svgProps(props), children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
270
+ }
271
+ function PlusIcon(props) {
272
+ return /* @__PURE__ */ jsxs("svg", { ...svgProps(props), children: [
273
+ /* @__PURE__ */ jsx("path", { d: "M5 12h14" }),
274
+ /* @__PURE__ */ jsx("path", { d: "M12 5v14" })
275
+ ] });
276
+ }
277
+ function SearchIcon(props) {
278
+ return /* @__PURE__ */ jsxs("svg", { ...svgProps(props), children: [
279
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
280
+ /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
281
+ ] });
282
+ }
246
283
 
247
284
  // src/core/file-kind.ts
248
285
  var ROWS = [
@@ -839,6 +876,8 @@ function InlineMediaRef({
839
876
  playsInline,
840
877
  preload,
841
878
  controlsList,
879
+ poster,
880
+ playbackLabel,
842
881
  rounded = "md",
843
882
  onClick,
844
883
  onError,
@@ -882,7 +921,7 @@ function InlineMediaRef({
882
921
  {
883
922
  isPlaying: isMediaPlaying,
884
923
  source: "file-media",
885
- label: alt || "Media file",
924
+ label: playbackLabel ?? (alt || "Media file"),
886
925
  trackKey
887
926
  },
888
927
  sessionElRef
@@ -1023,6 +1062,7 @@ function InlineMediaRef({
1023
1062
  playsInline,
1024
1063
  preload,
1025
1064
  controlsList,
1065
+ poster,
1026
1066
  onLoadedData: onLoad,
1027
1067
  onError: handleLoadError,
1028
1068
  crossOrigin,
@@ -1987,6 +2027,10 @@ function MediaLightbox({
1987
2027
  fileName,
1988
2028
  alt,
1989
2029
  as,
2030
+ autoPlay,
2031
+ playsInline,
2032
+ poster,
2033
+ playbackLabel,
1990
2034
  actions,
1991
2035
  hideUnavailableActions = false,
1992
2036
  headerExtra,
@@ -2065,7 +2109,11 @@ function MediaLightbox({
2065
2109
  fit: "contain",
2066
2110
  rounded: "none",
2067
2111
  alt: alt ?? fileName ?? "",
2068
- as
2112
+ as,
2113
+ autoPlay,
2114
+ playsInline,
2115
+ poster,
2116
+ playbackLabel
2069
2117
  }
2070
2118
  ) })
2071
2119
  }
@@ -2096,16 +2144,22 @@ export {
2096
2144
  FileVideoIcon,
2097
2145
  FolderIcon,
2098
2146
  FolderOpenIcon,
2147
+ GlobeIcon,
2099
2148
  ImageIcon,
2100
2149
  ImageOffIcon,
2101
2150
  InlineMediaRef,
2151
+ Link2Icon,
2102
2152
  MediaActionToolbar,
2103
2153
  MediaLightbox,
2104
2154
  MediaThumbnail,
2105
2155
  MusicIcon,
2106
2156
  PackageBoxIcon,
2107
2157
  PenToolIcon,
2158
+ PlusIcon,
2159
+ SearchIcon,
2160
+ Settings2Icon,
2108
2161
  Share2Icon,
2162
+ SpinnerIcon,
2109
2163
  SubtitlesIcon,
2110
2164
  UploadIcon,
2111
2165
  UploadProgressList,