@ai-matrx/messaging 0.11.6 → 0.11.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/react.cjs CHANGED
@@ -2132,6 +2132,7 @@ var import_react3 = require("react");
2132
2132
  var import_react4 = require("@ai-matrx/realtime/react");
2133
2133
 
2134
2134
  // src/core/format.ts
2135
+ var import_format = require("@ai-matrx/kit/format");
2135
2136
  var MINUTE = 6e4;
2136
2137
  var HOUR = 60 * MINUTE;
2137
2138
  var DAY = 24 * HOUR;
@@ -2215,11 +2216,8 @@ function participantNames(participants, excluding) {
2215
2216
  }
2216
2217
  function formatLastSeen(lastSeenMs, now = Date.now()) {
2217
2218
  if (lastSeenMs === null) return "";
2218
- const elapsed = now - lastSeenMs;
2219
- if (elapsed < 2 * MINUTE) return "Active now";
2220
- if (elapsed < HOUR) return `Active ${Math.round(elapsed / MINUTE)}m ago`;
2221
- if (elapsed < DAY) return `Active ${Math.round(elapsed / HOUR)}h ago`;
2222
- return `Active ${Math.round(elapsed / DAY)}d ago`;
2219
+ if (now - lastSeenMs < 2 * MINUTE) return "Active now";
2220
+ return `Active ${(0, import_format.formatRelativeTime)(lastSeenMs, { style: "short", now })}`;
2223
2221
  }
2224
2222
 
2225
2223
  // src/react/hooks.ts
@@ -2593,7 +2591,7 @@ function resolveActor(message, sender) {
2593
2591
  }
2594
2592
 
2595
2593
  // src/react/parts.tsx
2596
- var import_format2 = require("@ai-matrx/kit/format");
2594
+ var import_format3 = require("@ai-matrx/kit/format");
2597
2595
 
2598
2596
  // src/react/icons.tsx
2599
2597
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -2690,7 +2688,7 @@ var UsersIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2690
2688
  var import_jsx_runtime3 = require("react/jsx-runtime");
2691
2689
  function Avatar(props) {
2692
2690
  const seed = props.seed ?? props.name;
2693
- const paletteIndex = (0, import_format2.avatarPaletteIndex)(seed);
2691
+ const paletteIndex = (0, import_format3.avatarPaletteIndex)(seed);
2694
2692
  const className = `mx-msg__avatar${props.small === true ? " mx-msg__avatar--sm" : ""}`;
2695
2693
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2696
2694
  "span",
@@ -2699,7 +2697,7 @@ function Avatar(props) {
2699
2697
  style: { background: `var(--mx-msg-avatar-${paletteIndex})` },
2700
2698
  "aria-hidden": "true",
2701
2699
  children: [
2702
- props.imageUrl != null && props.imageUrl.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { className: "mx-msg__avatar-img", src: props.imageUrl, alt: "", loading: "lazy" }) : (0, import_format2.getInitials)(props.name),
2700
+ props.imageUrl != null && props.imageUrl.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { className: "mx-msg__avatar-img", src: props.imageUrl, alt: "", loading: "lazy" }) : (0, import_format3.getInitials)(props.name),
2703
2701
  props.online === true ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("i", { className: "mx-msg__presence" }) : null
2704
2702
  ]
2705
2703
  }