@poolse/react-ui 2.0.13 → 2.1.1
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/index.cjs +3 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -38
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, useReactions, useThread, useAttachmentUrl } from '@poolse/react';
|
|
2
|
+
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, computeGroupPosition, sameDay, formatDayLabel, useReactions, useThread, useAttachmentUrl } from '@poolse/react';
|
|
3
3
|
import { forwardRef, useState, useRef, useImperativeHandle, useEffect, useCallback, useMemo, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import ReactMarkdown from 'react-markdown';
|
|
@@ -42,43 +42,6 @@ function PoolseFonts() {
|
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// src/grouping.ts
|
|
46
|
-
function computeGroupPosition(msg, prev, next, windowMs) {
|
|
47
|
-
const continuesPrev = sameGroup(msg, prev, windowMs);
|
|
48
|
-
const continuesNext = sameGroup(next, msg, windowMs);
|
|
49
|
-
if (continuesPrev && continuesNext) return "middle";
|
|
50
|
-
if (continuesPrev) return "last";
|
|
51
|
-
if (continuesNext) return "first";
|
|
52
|
-
return "standalone";
|
|
53
|
-
}
|
|
54
|
-
function sameGroup(a, b, windowMs) {
|
|
55
|
-
if (!a || !b) return false;
|
|
56
|
-
if (a.sender_id !== b.sender_id) return false;
|
|
57
|
-
if (!sameDay(a.inserted_at, b.inserted_at)) return false;
|
|
58
|
-
const ta = new Date(a.inserted_at).getTime();
|
|
59
|
-
const tb = new Date(b.inserted_at).getTime();
|
|
60
|
-
return Math.abs(ta - tb) <= windowMs;
|
|
61
|
-
}
|
|
62
|
-
function sameDay(a, b) {
|
|
63
|
-
const da = new Date(a);
|
|
64
|
-
const db = new Date(b);
|
|
65
|
-
return da.getFullYear() === db.getFullYear() && da.getMonth() === db.getMonth() && da.getDate() === db.getDate();
|
|
66
|
-
}
|
|
67
|
-
function formatDayLabel(iso, now = /* @__PURE__ */ new Date()) {
|
|
68
|
-
const d = new Date(iso);
|
|
69
|
-
const startOfDay = (x) => new Date(x.getFullYear(), x.getMonth(), x.getDate()).getTime();
|
|
70
|
-
const diffDays = Math.floor((startOfDay(now) - startOfDay(d)) / 864e5);
|
|
71
|
-
if (diffDays === 0) return "Today";
|
|
72
|
-
if (diffDays === 1) return "Yesterday";
|
|
73
|
-
if (diffDays < 7) {
|
|
74
|
-
return d.toLocaleDateString(void 0, { weekday: "long" });
|
|
75
|
-
}
|
|
76
|
-
if (d.getFullYear() === now.getFullYear()) {
|
|
77
|
-
return d.toLocaleDateString(void 0, { weekday: "short", day: "numeric", month: "short" });
|
|
78
|
-
}
|
|
79
|
-
return d.toLocaleDateString(void 0, { day: "numeric", month: "short", year: "numeric" });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
45
|
// src/listAutocomplete.ts
|
|
83
46
|
var UNORDERED_RE = /^(\s*)([-*+]) (.*)$/;
|
|
84
47
|
var ORDERED_RE = /^(\s*)(\d+)\. (.*)$/;
|