@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/CHANGELOG.md +31 -0
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +6 -8
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +13 -1
- package/dist/react.d.ts +13 -1
- package/dist/react.js +3 -5
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1588,7 +1588,19 @@ declare function groupMessages(messages: readonly Message[], args?: {
|
|
|
1588
1588
|
/** "Ana is typing…" / "Ana and Bo are typing…" / "3 people are typing…" */
|
|
1589
1589
|
declare function formatTypists(names: readonly string[]): string | null;
|
|
1590
1590
|
declare function participantNames(participants: readonly UserSummary[], excluding: UserId): readonly string[];
|
|
1591
|
-
/**
|
|
1591
|
+
/**
|
|
1592
|
+
* "Active now" / "Active 5m ago" — presence, said honestly.
|
|
1593
|
+
*
|
|
1594
|
+
* THE CASCADE WAS A RELATIVE TIME WEARING A DURATION'S CLOTHES (2026-09-12).
|
|
1595
|
+
* Three hand-rolled tiers turned an elapsed millisecond count into `5m ago` /
|
|
1596
|
+
* `3h ago` / `2d ago`, which is exactly `formatRelativeTime`'s `short` voice —
|
|
1597
|
+
* and this package already depends on kit. A package re-deriving another
|
|
1598
|
+
* package's capability ships the duplicate to every consumer of this one.
|
|
1599
|
+
*
|
|
1600
|
+
* What stays local is the only part that is a PRODUCT decision rather than a
|
|
1601
|
+
* formatting one: the two-minute "Active now" window, which says presence is
|
|
1602
|
+
* live rather than reporting a number nobody acts on.
|
|
1603
|
+
*/
|
|
1592
1604
|
declare function formatLastSeen(lastSeenMs: number | null, now?: number): string;
|
|
1593
1605
|
|
|
1594
1606
|
/**
|
package/dist/react.d.ts
CHANGED
|
@@ -1588,7 +1588,19 @@ declare function groupMessages(messages: readonly Message[], args?: {
|
|
|
1588
1588
|
/** "Ana is typing…" / "Ana and Bo are typing…" / "3 people are typing…" */
|
|
1589
1589
|
declare function formatTypists(names: readonly string[]): string | null;
|
|
1590
1590
|
declare function participantNames(participants: readonly UserSummary[], excluding: UserId): readonly string[];
|
|
1591
|
-
/**
|
|
1591
|
+
/**
|
|
1592
|
+
* "Active now" / "Active 5m ago" — presence, said honestly.
|
|
1593
|
+
*
|
|
1594
|
+
* THE CASCADE WAS A RELATIVE TIME WEARING A DURATION'S CLOTHES (2026-09-12).
|
|
1595
|
+
* Three hand-rolled tiers turned an elapsed millisecond count into `5m ago` /
|
|
1596
|
+
* `3h ago` / `2d ago`, which is exactly `formatRelativeTime`'s `short` voice —
|
|
1597
|
+
* and this package already depends on kit. A package re-deriving another
|
|
1598
|
+
* package's capability ships the duplicate to every consumer of this one.
|
|
1599
|
+
*
|
|
1600
|
+
* What stays local is the only part that is a PRODUCT decision rather than a
|
|
1601
|
+
* formatting one: the two-minute "Active now" window, which says presence is
|
|
1602
|
+
* live rather than reporting a number nobody acts on.
|
|
1603
|
+
*/
|
|
1592
1604
|
declare function formatLastSeen(lastSeenMs: number | null, now?: number): string;
|
|
1593
1605
|
|
|
1594
1606
|
/**
|
package/dist/react.js
CHANGED
|
@@ -2037,6 +2037,7 @@ import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef as us
|
|
|
2037
2037
|
import { useTyping, usePresence } from "@ai-matrx/realtime/react";
|
|
2038
2038
|
|
|
2039
2039
|
// src/core/format.ts
|
|
2040
|
+
import { formatRelativeTime } from "@ai-matrx/kit/format";
|
|
2040
2041
|
var MINUTE = 6e4;
|
|
2041
2042
|
var HOUR = 60 * MINUTE;
|
|
2042
2043
|
var DAY = 24 * HOUR;
|
|
@@ -2120,11 +2121,8 @@ function participantNames(participants, excluding) {
|
|
|
2120
2121
|
}
|
|
2121
2122
|
function formatLastSeen(lastSeenMs, now = Date.now()) {
|
|
2122
2123
|
if (lastSeenMs === null) return "";
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
if (elapsed < HOUR) return `Active ${Math.round(elapsed / MINUTE)}m ago`;
|
|
2126
|
-
if (elapsed < DAY) return `Active ${Math.round(elapsed / HOUR)}h ago`;
|
|
2127
|
-
return `Active ${Math.round(elapsed / DAY)}d ago`;
|
|
2124
|
+
if (now - lastSeenMs < 2 * MINUTE) return "Active now";
|
|
2125
|
+
return `Active ${formatRelativeTime(lastSeenMs, { style: "short", now })}`;
|
|
2128
2126
|
}
|
|
2129
2127
|
|
|
2130
2128
|
// src/react/hooks.ts
|