@ai-matrx/media 0.3.0 → 0.4.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,7 +280,16 @@ 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
- declare function formatFileSize(bytes: number): string;
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;
284
293
  interface UploadProgressListProps {
285
294
  uploads: MediaUploadEntry[];
286
295
  /** Remove an entry from the tray (wire to `useMediaUpload().clearEntry`). */
package/dist/react.d.ts CHANGED
@@ -280,7 +280,16 @@ 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
- declare function formatFileSize(bytes: number): string;
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;
284
293
  interface UploadProgressListProps {
285
294
  uploads: MediaUploadEntry[];
286
295
  /** Remove an entry from the tray (wire to `useMediaUpload().clearEntry`). */
package/dist/react.js CHANGED
@@ -1748,7 +1748,7 @@ import { memo, useEffect as useEffect7, useRef as useRef7, useState as useState6
1748
1748
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1749
1749
  var AUTO_DISMISS_MS = 1e4;
1750
1750
  function formatFileSize(bytes) {
1751
- if (!Number.isFinite(bytes) || bytes < 0) return "0 B";
1751
+ if (bytes == null || !Number.isFinite(bytes) || bytes < 0) return "\u2014";
1752
1752
  if (bytes < 1024) return `${bytes} B`;
1753
1753
  const units = ["KB", "MB", "GB", "TB"];
1754
1754
  let value = bytes;