@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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @ai-matrx/media
2
2
 
3
+ ## 0.5.0 — 2026-09-07
4
+
5
+ **Consumer action (C28).** One export MOVED OUT of this package.
6
+
7
+ | was | now |
8
+ |---|---|
9
+ | `import { formatFileSize } from "@ai-matrx/media/react"` | `import { formatFileSize } from "@ai-matrx/kit/format"` |
10
+
11
+ The behaviour is identical, including the 0.4.0 guard this package earned:
12
+ `null` / `undefined` / `NaN` / `Infinity` / negative all collapse to an
13
+ em-dash, NOT to a confident, wrong `"0 B"`. Kit's copy carries that guard and
14
+ its regression tests, plus a `fallback` option and two more units (`PB`).
15
+
16
+ **Why.** Duplication census finding H1 (2026-09-07): `formatFileSize` was
17
+ hiding inside the `UploadProgressList` React component, so the six host twins
18
+ of it could only reach it by depending on this package's React bundle — a
19
+ settings page printing a byte count should not pull in the media uploader. It
20
+ now lives in `@ai-matrx/kit/format`, which has zero sibling dependencies.
21
+ Nothing is re-exported: this package imports kit directly.
22
+
23
+ New dependency: `@ai-matrx/kit` (`latest`).
24
+
3
25
  ## 0.4.5 — 2026-09-01
4
26
 
5
27
  ### Consumer action (C28)
package/dist/react.cjs CHANGED
@@ -66,7 +66,6 @@ __export(react_exports, {
66
66
  VolumeXIcon: () => VolumeXIcon,
67
67
  XIcon: () => XIcon,
68
68
  cn: () => cn,
69
- formatFileSize: () => formatFileSize,
70
69
  useMediaDropzone: () => useMediaDropzone
71
70
  });
72
71
  module.exports = __toCommonJS(react_exports);
@@ -1893,20 +1892,9 @@ function useMediaUpload() {
1893
1892
 
1894
1893
  // src/react/upload-progress-list.tsx
1895
1894
  var import_react12 = require("react");
1895
+ var import_format = require("@ai-matrx/kit/format");
1896
1896
  var import_jsx_runtime5 = require("react/jsx-runtime");
1897
1897
  var AUTO_DISMISS_MS = 1e4;
1898
- function formatFileSize(bytes) {
1899
- if (bytes == null || !Number.isFinite(bytes) || bytes < 0) return "\u2014";
1900
- if (bytes < 1024) return `${bytes} B`;
1901
- const units = ["KB", "MB", "GB", "TB"];
1902
- let value = bytes;
1903
- let unit = -1;
1904
- do {
1905
- value /= 1024;
1906
- unit += 1;
1907
- } while (value >= 1024 && unit < units.length - 1);
1908
- return `${value >= 10 ? Math.round(value) : value.toFixed(1)} ${units[unit] ?? "TB"}`;
1909
- }
1910
1898
  function UploadProgressListImpl({
1911
1899
  uploads,
1912
1900
  onDismiss,
@@ -2016,10 +2004,10 @@ function UploadProgressListImpl({
2016
2004
  }
2017
2005
  ) }),
2018
2006
  failed && u.error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mt-0.5 truncate text-[10px] text-destructive", children: u.error }) : !done ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "mt-0.5 text-[10px] text-muted-foreground", children: [
2019
- formatFileSize(u.bytesUploaded),
2007
+ (0, import_format.formatFileSize)(u.bytesUploaded),
2020
2008
  " /",
2021
2009
  " ",
2022
- formatFileSize(u.fileSize)
2010
+ (0, import_format.formatFileSize)(u.fileSize)
2023
2011
  ] }) : null
2024
2012
  ] }),
2025
2013
  canOpen ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-primary", children: [