@ai-matrx/media 0.5.5 → 0.5.7

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/viewers.js CHANGED
@@ -54,6 +54,7 @@ function cn(...inputs) {
54
54
  }
55
55
 
56
56
  // src/viewers/chrome.tsx
57
+ import { formatFileSize } from "@ai-matrx/kit/format";
57
58
  import { useCallback, useState } from "react";
58
59
 
59
60
  // src/react/icons.tsx
@@ -336,8 +337,7 @@ function ViewerToolbar({
336
337
  );
337
338
  }
338
339
  function truncationNote(maxBytes) {
339
- const mb = maxBytes / 1024 / 1024;
340
- return `truncated to the first ${mb >= 1 ? `${mb.toFixed(0)}MB` : `${(maxBytes / 1024).toFixed(0)}KB`}`;
340
+ return `truncated to the first ${formatFileSize(maxBytes)}`;
341
341
  }
342
342
 
343
343
  // src/viewers/use-viewer-bytes.ts
@@ -953,7 +953,7 @@ function FileIcon2({
953
953
  }
954
954
 
955
955
  // src/viewers/generic-viewer.tsx
956
- import { formatFileSize } from "@ai-matrx/kit/format";
956
+ import { formatFileSize as formatFileSize2 } from "@ai-matrx/kit/format";
957
957
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
958
958
  function GenericViewer({
959
959
  fileName,
@@ -979,7 +979,7 @@ function GenericViewer({
979
979
  /* @__PURE__ */ jsx5(FileIcon2, { fileName, size: 48 }),
980
980
  /* @__PURE__ */ jsxs4("div", { children: [
981
981
  /* @__PURE__ */ jsx5("p", { className: "max-w-md truncate text-sm font-medium", children: fileName }),
982
- /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: formatFileSize(fileSize ?? null) })
982
+ /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: formatFileSize2(fileSize ?? null) })
983
983
  ] }),
984
984
  /* @__PURE__ */ jsx5("p", { className: "max-w-sm text-sm text-muted-foreground", children: generic?.message ?? (hasViewAsText ? "No built-in previewer for this file type." : "This file type can't be previewed here.") }),
985
985
  /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [