@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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @ai-matrx/media
2
2
 
3
+ ## 0.5.7
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/media/v0.5.6..npm/media/v0.5.7 -- apps/shared/media`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.5.6 — 2026-09-12
10
+
11
+ ### Consumer action (C28)
12
+
13
+ - Upgrade. No API change. The text and code viewers' truncation note now reads
14
+ "Preview truncated to the first 1.0 MB." where it read "…first 1MB." — it is
15
+ `formatFileSize`'s number now, so a screenshot-diffing test on that exact
16
+ sentence is the only thing that can notice.
17
+
18
+ ### Fixed
19
+
20
+ - `truncationNote` no longer carries its own byte-size formatter. A package that
21
+ duplicates another package's capability is the worst form of that defect: this
22
+ body did `maxBytes / 1024 / 1024` and printed `${mb.toFixed(0)}MB`, so a
23
+ 1.5 MiB ceiling announced "2MB" — over-stating the limit by half a megabyte —
24
+ and anything under ~512 bytes announced "0KB", the confident zero
25
+ `formatFileSize` exists to refuse (an 8-byte cap in this package's own test
26
+ rendered "truncated to the first 0KB" and the test was green). It now calls
27
+ `formatFileSize` from `@ai-matrx/kit/format`, which this package already
28
+ depended on and already imported in `viewers/generic-viewer.tsx`.
29
+
3
30
  ## 0.5.5
4
31
 
5
32
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/viewers.cjs CHANGED
@@ -100,6 +100,7 @@ function cn(...inputs) {
100
100
  }
101
101
 
102
102
  // src/viewers/chrome.tsx
103
+ var import_format = require("@ai-matrx/kit/format");
103
104
  var import_react = require("react");
104
105
 
105
106
  // src/react/icons.tsx
@@ -382,8 +383,7 @@ function ViewerToolbar({
382
383
  );
383
384
  }
384
385
  function truncationNote(maxBytes) {
385
- const mb = maxBytes / 1024 / 1024;
386
- return `truncated to the first ${mb >= 1 ? `${mb.toFixed(0)}MB` : `${(maxBytes / 1024).toFixed(0)}KB`}`;
386
+ return `truncated to the first ${(0, import_format.formatFileSize)(maxBytes)}`;
387
387
  }
388
388
 
389
389
  // src/viewers/use-viewer-bytes.ts
@@ -995,7 +995,7 @@ function FileIcon2({
995
995
  }
996
996
 
997
997
  // src/viewers/generic-viewer.tsx
998
- var import_format = require("@ai-matrx/kit/format");
998
+ var import_format2 = require("@ai-matrx/kit/format");
999
999
  var import_jsx_runtime5 = require("react/jsx-runtime");
1000
1000
  function GenericViewer({
1001
1001
  fileName,
@@ -1021,7 +1021,7 @@ function GenericViewer({
1021
1021
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FileIcon2, { fileName, size: 48 }),
1022
1022
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
1023
1023
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "max-w-md truncate text-sm font-medium", children: fileName }),
1024
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_format.formatFileSize)(fileSize ?? null) })
1024
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_format2.formatFileSize)(fileSize ?? null) })
1025
1025
  ] }),
1026
1026
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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.") }),
1027
1027
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [