@ai-matrx/messaging 0.11.5 → 0.11.6
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 +2 -17
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -13
- package/dist/index.d.ts +1 -13
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +8 -6
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -13
- package/dist/react.d.ts +1 -13
- package/dist/react.js +5 -3
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
package/dist/react.cjs
CHANGED
|
@@ -2132,7 +2132,6 @@ 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");
|
|
2136
2135
|
var MINUTE = 6e4;
|
|
2137
2136
|
var HOUR = 60 * MINUTE;
|
|
2138
2137
|
var DAY = 24 * HOUR;
|
|
@@ -2216,8 +2215,11 @@ function participantNames(participants, excluding) {
|
|
|
2216
2215
|
}
|
|
2217
2216
|
function formatLastSeen(lastSeenMs, now = Date.now()) {
|
|
2218
2217
|
if (lastSeenMs === null) return "";
|
|
2219
|
-
|
|
2220
|
-
|
|
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`;
|
|
2221
2223
|
}
|
|
2222
2224
|
|
|
2223
2225
|
// src/react/hooks.ts
|
|
@@ -2591,7 +2593,7 @@ function resolveActor(message, sender) {
|
|
|
2591
2593
|
}
|
|
2592
2594
|
|
|
2593
2595
|
// src/react/parts.tsx
|
|
2594
|
-
var
|
|
2596
|
+
var import_format2 = require("@ai-matrx/kit/format");
|
|
2595
2597
|
|
|
2596
2598
|
// src/react/icons.tsx
|
|
2597
2599
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -2688,7 +2690,7 @@ var UsersIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
|
2688
2690
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2689
2691
|
function Avatar(props) {
|
|
2690
2692
|
const seed = props.seed ?? props.name;
|
|
2691
|
-
const paletteIndex = (0,
|
|
2693
|
+
const paletteIndex = (0, import_format2.avatarPaletteIndex)(seed);
|
|
2692
2694
|
const className = `mx-msg__avatar${props.small === true ? " mx-msg__avatar--sm" : ""}`;
|
|
2693
2695
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2694
2696
|
"span",
|
|
@@ -2697,7 +2699,7 @@ function Avatar(props) {
|
|
|
2697
2699
|
style: { background: `var(--mx-msg-avatar-${paletteIndex})` },
|
|
2698
2700
|
"aria-hidden": "true",
|
|
2699
2701
|
children: [
|
|
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,
|
|
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),
|
|
2701
2703
|
props.online === true ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("i", { className: "mx-msg__presence" }) : null
|
|
2702
2704
|
]
|
|
2703
2705
|
}
|