@ai-matrx/media 0.4.5 → 0.5.0

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
@@ -280,16 +280,6 @@ interface FileUploadDropzoneProps {
280
280
  }
281
281
  declare function FileUploadDropzone({ uploadOptions, accept, maxSize, enablePaste, mode, children, className, actions, onUploadStart, onUploaded, onError, onOpenFile, pickerEventName, }: FileUploadDropzoneProps): react.JSX.Element;
282
282
 
283
- /**
284
- * Human file size.
285
- *
286
- * `null` / `undefined` / NaN / negative collapse to an em-dash, NOT to
287
- * "0 B" (fixed at 0.4.0 while absorbing the viewer bodies — matrx-frontend's
288
- * `formatFileSize` already had this guard and the package's did not, so a
289
- * corrupt or mid-upload `size` row rendered as a confident, wrong "0 B"
290
- * instead of an honest "size unknown").
291
- */
292
- declare function formatFileSize(bytes: number | null | undefined): string;
293
283
  interface UploadProgressListProps {
294
284
  uploads: MediaUploadEntry[];
295
285
  /** Remove an entry from the tray (wire to `useMediaUpload().clearEntry`). */
@@ -350,4 +340,4 @@ interface MediaLightboxProps {
350
340
  }
351
341
  declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, autoPlay, playsInline, poster, playbackLabel, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
352
342
 
353
- 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 };
343
+ 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, useMediaDropzone };
package/dist/react.d.ts CHANGED
@@ -280,16 +280,6 @@ interface FileUploadDropzoneProps {
280
280
  }
281
281
  declare function FileUploadDropzone({ uploadOptions, accept, maxSize, enablePaste, mode, children, className, actions, onUploadStart, onUploaded, onError, onOpenFile, pickerEventName, }: FileUploadDropzoneProps): react.JSX.Element;
282
282
 
283
- /**
284
- * Human file size.
285
- *
286
- * `null` / `undefined` / NaN / negative collapse to an em-dash, NOT to
287
- * "0 B" (fixed at 0.4.0 while absorbing the viewer bodies — matrx-frontend's
288
- * `formatFileSize` already had this guard and the package's did not, so a
289
- * corrupt or mid-upload `size` row rendered as a confident, wrong "0 B"
290
- * instead of an honest "size unknown").
291
- */
292
- declare function formatFileSize(bytes: number | null | undefined): string;
293
283
  interface UploadProgressListProps {
294
284
  uploads: MediaUploadEntry[];
295
285
  /** Remove an entry from the tray (wire to `useMediaUpload().clearEntry`). */
@@ -350,4 +340,4 @@ interface MediaLightboxProps {
350
340
  }
351
341
  declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, autoPlay, playsInline, poster, playbackLabel, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
352
342
 
353
- 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 };
343
+ 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, useMediaDropzone };
package/dist/react.js CHANGED
@@ -1838,20 +1838,9 @@ function useMediaUpload() {
1838
1838
 
1839
1839
  // src/react/upload-progress-list.tsx
1840
1840
  import { memo, useEffect as useEffect8, useRef as useRef8, useState as useState7 } from "react";
1841
+ import { formatFileSize } from "@ai-matrx/kit/format";
1841
1842
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1842
1843
  var AUTO_DISMISS_MS = 1e4;
1843
- function formatFileSize(bytes) {
1844
- if (bytes == null || !Number.isFinite(bytes) || bytes < 0) return "\u2014";
1845
- if (bytes < 1024) return `${bytes} B`;
1846
- const units = ["KB", "MB", "GB", "TB"];
1847
- let value = bytes;
1848
- let unit = -1;
1849
- do {
1850
- value /= 1024;
1851
- unit += 1;
1852
- } while (value >= 1024 && unit < units.length - 1);
1853
- return `${value >= 10 ? Math.round(value) : value.toFixed(1)} ${units[unit] ?? "TB"}`;
1854
- }
1855
1844
  function UploadProgressListImpl({
1856
1845
  uploads,
1857
1846
  onDismiss,
@@ -2413,7 +2402,6 @@ export {
2413
2402
  VolumeXIcon,
2414
2403
  XIcon,
2415
2404
  cn,
2416
- formatFileSize,
2417
2405
  useMediaDropzone
2418
2406
  };
2419
2407
  //# sourceMappingURL=react.js.map