@ai-matrx/media 0.5.9 → 0.5.11

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
@@ -388,7 +388,10 @@ function latch() {
388
388
  }
389
389
  function failureMediaIdentity(ref, src) {
390
390
  if (ref && typeof ref === "object" && ref.file_id) return `file:${ref.file_id}`;
391
- const raw = typeof ref === "string" ? ref : (ref && typeof ref === "object" ? ref.url ?? null : null) ?? src ?? null;
391
+ let raw;
392
+ if (typeof ref === "string") raw = ref;
393
+ else if (ref && typeof ref === "object" && ref.url) raw = ref.url;
394
+ else raw = src;
392
395
  if (!raw) return "<unknown-media>";
393
396
  if (raw.startsWith("blob:")) return "blob:object-url";
394
397
  try {
@@ -1288,6 +1291,7 @@ function SvgSourceView({ source, maxBytes = 1024 * 1024 }) {
1288
1291
  }
1289
1292
 
1290
1293
  // src/viewers/text-viewer.tsx
1294
+ import { formatCount } from "@ai-matrx/kit/format";
1291
1295
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1292
1296
  function TextViewer({
1293
1297
  source,
@@ -1305,7 +1309,7 @@ function TextViewer({
1305
1309
  className: cn("flex h-full w-full flex-col overflow-hidden", className),
1306
1310
  children: [
1307
1311
  /* @__PURE__ */ jsxs8(ViewerToolbar, { children: [
1308
- /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: truncated ? `Preview ${truncationNote(maxBytes)}.` : `${text.length.toLocaleString()} characters` }),
1312
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: truncated ? `Preview ${truncationNote(maxBytes)}.` : `${formatCount(text.length)} characters` }),
1309
1313
  /* @__PURE__ */ jsx9(ViewerCopyButton, { text })
1310
1314
  ] }),
1311
1315
  /* @__PURE__ */ jsx9("pre", { className: "flex-1 overflow-auto bg-background p-3 font-mono text-xs leading-5 break-words whitespace-pre-wrap", children: text })