@poolse/react-ui 3.5.0 → 3.6.0

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 CHANGED
@@ -4,6 +4,131 @@ All notable changes to `@poolse/react-ui` are documented here. Format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
5
  [semver](https://semver.org).
6
6
 
7
+ ## [3.6.0] - 2026-11-21
8
+
9
+ ### Added
10
+
11
+ - Presence: `<PresenceBadge state doNotDisturb? size?>` — online (`--poolse-success`),
12
+ away (`--poolse-warning`), in a call (`--poolse-accent`, with a phone glyph),
13
+ do not disturb (a moon); offline draws nothing. `Avatar presence` takes a
14
+ state, a `Presence`, or `true` to look it up with `useUserPresence(userId)`
15
+ (new `Avatar userId`); `Avatar size="xs"` (20px). Helpers `presenceText`
16
+ ("Online", "Away", "In a call", "Last seen 5m ago"), `presenceStateLabel`,
17
+ `formatRelativeTime`.
18
+ - `showPresence` on `ConversationList` (direct rows, default `true`),
19
+ `MemberList` (badge and state under each name, default `true`), `ChatHeader`
20
+ (direct chats: badge and state as the subtitle, default `true`) and
21
+ `ConversationView` / `MessageRow` (message avatars, default `false`).
22
+
23
+ - Link previews: `<LinkPreviewCard preview onRemove?>` — a web page's image,
24
+ site name with favicon, title (2 lines) and description (3 lines), or an
25
+ image link drawn inline. `ConversationView`, `MessageRow` and `MessageBubble`
26
+ draw `message.link_previews` under the text in every layout (prop
27
+ `linkPreviews`, default `true`); nothing is reserved until they arrive. The
28
+ sender gets a × that hides the card and calls
29
+ `messages.update(id, { remove_link_previews: [url] })` (the card returns if
30
+ that fails). Only `http(s)` links are drawn.
31
+ - Thread summaries: `<ThreadSummary message onOpen? maxAvatars?>` — up to three
32
+ stacked avatars of the people who replied (`thread_participants`) and
33
+ "N replies · last reply 5m ago" (`last_reply_at`). It replaces the reply
34
+ count under thread roots in every layout (same classes and accessible name)
35
+ and opens the `ThreadView`; `thread:updated` keeps it live.
36
+ - Edit history: the "edited" mark on a message (every layout) is a button that
37
+ opens a popover with the earlier versions from `messages.edits(id)`, oldest
38
+ first ("Original · …"). A 403 (not the sender or a conversation admin) turns
39
+ it back into plain text. `<EditedLabel messageId label?>` and
40
+ `useEditHistory(messageId)` (`{ label(), popover }`) for custom rows.
41
+ - `<EmojiPicker onPick onClose? autoFocus?>`: search (by Unicode name and a few
42
+ aliases), recently used (memory + `localStorage`, guarded), category tabs,
43
+ arrow-key navigation; ~800 emoji with no dependency. The list is a separate
44
+ module loaded on first open (its own chunk in the ESM build);
45
+ `loadEmojiData()` warms it.
46
+ - `ReactionPicker` ends with a "+" (More emoji) that opens the full picker, so
47
+ the message toolbar's React button and `ReactionStrip`'s "+" reach every
48
+ emoji. Picks are remembered as recent.
49
+ - An emoji button in `MessageComposer` and `MentionInput` (`emojiPicker`,
50
+ default `true`) inserts at the caret; `ConversationView emojiPicker` passes
51
+ it through.
52
+ - Uploads: pasting files (a screenshot, files copied in the OS) into
53
+ `MessageComposer` / `MentionInput` queues them like the paperclip; image
54
+ chips show a local thumbnail before sending (`UploadQueueStrip previewFor`,
55
+ `UploadQueueStripProps` exported). `maxFileSize` (bytes) and
56
+ `acceptFileTypes` (MIME types, `image/*`, `.ext`; also the picker's
57
+ `accept`) on both composers, `ThreadView` and `ConversationView` refuse other
58
+ files before upload with an error chip ("Larger than 25 MB", "This file type
59
+ isn't allowed"). Dropping files on the conversation (overlay) goes through
60
+ the same checks.
61
+ - Drafts: `ConversationView` keeps an unsent draft per user and conversation —
62
+ the text and the message being quoted, not files — in memory across
63
+ conversation switches and in `localStorage` (guarded; key
64
+ `poolse:draft:<userId>:<conversationId>`), cleared on send. Props
65
+ `persistDrafts` (default `true`) and `draftStorage` (`DraftStorage`: sync or
66
+ async `get` / `set` / `remove`); `localDraftStorage`, `ConversationDraft`
67
+ exported. The composer is now keyed by conversation, so its text no longer
68
+ carries over to the next conversation.
69
+ - `MessageComposer` / `MentionInput` `onValueChange(text)`.
70
+ - "New messages" divider: opening a conversation with unread messages draws a
71
+ divider above the first one, from the viewer's read position when the
72
+ conversation opened (their membership's `last_read_sequence` /
73
+ `last_read_message_id`, so `members` must load — on by default). Marking
74
+ read doesn't move it; it goes when the conversation is reopened or the
75
+ viewer sends. While it's off-screen (or older than the loaded pages) a
76
+ "Jump to first unread" pill at the top of the feed scrolls to it, loading
77
+ older pages with `loadUntil` first when needed; it can be dismissed. The
78
+ "↓ N new" button is unchanged. Every layout, and with `renderMessage`. The
79
+ view now marks the conversation read only after it has the members (the read
80
+ position), so the divider can't lose the race.
81
+ - Mark unread: a "Mark unread" message action on other people's messages (a
82
+ button in `bubbles`, under More in `list` / `compact`) calls
83
+ `conversations.one(id).markUnread(messageId)`; the divider moves above that
84
+ message and the view doesn't re-mark it read until a newer message arrives
85
+ (badges follow from the server's `conversation:read`). A failure shows a
86
+ notice. `MessageActions onMarkUnread`, `MessageRow onMarkUnread`.
87
+ - `ConversationList` (S6): infinite scroll — the next page of
88
+ `useConversations()` loads as the list nears its end (`loadMore`,
89
+ `hasMore`, `loadingMore`; a "Loading…" row meanwhile); controlled lists pass
90
+ `hasMore`, `loadingMore`, `onLoadMore`. `density` (`'comfortable'` |
91
+ `'compact'`: one line, small avatar, no preview); `sections`
92
+ (`ConversationListSection[]`, `{ title, filter }`: each conversation under
93
+ the first section that takes it, empty sections hidden) or `groupBy="type"`
94
+ ("Channels", "Direct messages"); a `header` slot above the list.
95
+ - `MessageComposerHandle` (the `MessageComposer` / `MentionInput` ref) gains
96
+ `getText()`, `setText(text)` and `focus()`.
97
+ - `ConversationView` shows a notice when a send is refused because the quoted
98
+ message was deleted (`quoted_message_deleted`): the quote is dropped and the
99
+ text is put back to send again.
100
+
101
+ ### Changed
102
+
103
+ - `MentionInput` suggestions match a member's resolved display name
104
+ (`labelFor`, else the SDK's `userResolver`, resolved when the menu opens) or
105
+ their external id, best matches first, at most 8; each shows an avatar and
106
+ the external id. The viewer isn't offered. Hovering moves the selection. A
107
+ picked member whose `@name` is deleted before sending is no longer sent in
108
+ `mentions`. The listbox ids are unique per input (`useId`).
109
+ - Deleted messages (tombstones) read "This message was deleted" (muted, italic)
110
+ in every layout, with no actions, reactions, quote or attachments, and keep
111
+ their thread link while the thread has replies. A quote of a deleted message
112
+ reads "Original message deleted" (italic). A reply chip whose message is
113
+ deleted meanwhile is dropped.
114
+ - `MemberList` reads each member's presence with `usePresenceMany` (online /
115
+ away / in a call / last seen) instead of who has the conversation open;
116
+ `onlineExternalIds` still gives the old green dot.
117
+ - `ChatHeader` takes a direct chat's subtitle from the other person's presence,
118
+ falling back to "Online" while they have the conversation open.
119
+
120
+ - `ConversationList` renders inside a `.poolse-conversation-list` wrapper
121
+ (header, then the `.poolse-list`), and takes its colours from the theme's
122
+ sidebar tokens (`--poolse-sidebar`, `--poolse-sidebar-text`,
123
+ `--poolse-sidebar-active`, `--poolse-sidebar-active-text`; badges from
124
+ `--poolse-badge` / `--poolse-badge-text`), falling back to the surface /
125
+ brand tokens it used before. A failed refresh keeps the rows on screen
126
+ instead of replacing them with the error.
127
+
128
+ ### Deprecated
129
+
130
+ - `Avatar online` — use `presence="online"`.
131
+
7
132
  ## [3.5.0] - 2026-11-21
8
133
 
9
134
  - No changes; released with the other `@poolse/*` packages at 3.5.0.
package/README.md CHANGED
@@ -78,6 +78,42 @@ message, pass `slots={{ header, body, attachments, reactions, thread, actions }}
78
78
  — each is `(props) => ReactNode` and gets the default rendering as `children`.
79
79
  `renderMessage(msg, meId, { layout, renderDefault })` replaces whole rows.
80
80
 
81
+ ## Chat features
82
+
83
+ - **Presence.** `<Avatar presence>` takes a state (`'online' | 'away' |
84
+ 'in_call' | 'offline'`), a `Presence`, or `true` with `userId` to look it up
85
+ live; `<PresenceBadge state doNotDisturb>` is the badge alone. Direct rows in
86
+ `ConversationList`, `ChatHeader` (with "Online" / "Away" / "In a call" /
87
+ "Last seen …") and `MemberList` show it; turn it off with
88
+ `showPresence={false}`. `ConversationView showPresence` adds it to message
89
+ avatars (off by default).
90
+ - **Link previews** show under the text in every layout (`linkPreviews`,
91
+ default on); the sender can remove one with its ×. `<LinkPreviewCard
92
+ preview>` draws one on its own.
93
+ - **Thread summaries** under thread roots: stacked participant avatars, "N
94
+ replies · last reply 5m ago"; click opens the thread (`<ThreadSummary>`).
95
+ - **Edit history.** "edited" opens the earlier versions (`messages.edits`);
96
+ people the server doesn't show history to (403) see plain text.
97
+ - **Emoji.** `<EmojiPicker>` (search, recent, categories; its data loads on
98
+ first open) behind the reaction "+" and a composer button
99
+ (`emojiPicker={false}` hides it).
100
+ - **Uploads**: the paperclip, pasting into the composer, or dropping on the
101
+ conversation; chips (with image thumbnails) until sent. `maxFileSize` and
102
+ `acceptFileTypes` refuse other files with an error chip.
103
+ - **Drafts** per conversation (text and quote) survive switching and reloads;
104
+ `persistDrafts={false}` turns them off, `draftStorage={{ get, set, remove }}`
105
+ stores them elsewhere.
106
+ - **Unread.** A "New messages" divider above the first unread message (from
107
+ where you'd read to when you opened the conversation), a "Jump to first
108
+ unread" pill while it's off-screen, and a "Mark unread" action on others'
109
+ messages.
110
+ - **ConversationList** pages itself as it's scrolled (`useConversations().loadMore`),
111
+ takes `density="compact"`, `groupBy="type"` or `sections={[{ title, filter }]}`,
112
+ a `header`, and the theme's sidebar colours.
113
+ - **Deleted messages** read "This message was deleted" and keep their thread
114
+ link; quotes of them read "Original message deleted". A send refused with
115
+ `quoted_message_deleted` shows a notice and puts the text back.
116
+
81
117
  ## Components
82
118
 
83
119
  - Composed: `PoolseInbox` (with a ref: `open`, `openDirect`, `openGroup`,
@@ -86,13 +122,14 @@ message, pass `slots={{ header, body, attachments, reactions, thread, actions }}
86
122
  - Sheets: `UserPickerSheet`, `GroupDetailsSheet`.
87
123
  - Messages: `MessageBubble`, `EditableMessageBubble`, `MessageActions`,
88
124
  `TypingIndicator`, `CallLogRow`, `LiveCallBanner`.
89
- - Composer: `MessageComposer` (ref: `addFiles`), `MentionInput`,
90
- `UploadQueueStrip`, `AttachmentPreview`.
125
+ - Composer: `MessageComposer` (ref: `addFiles`, `getText`, `setText`,
126
+ `focus`), `MentionInput`, `UploadQueueStrip`, `AttachmentPreview`.
127
+ - Rich content: `LinkPreviewCard`.
91
128
  - Lists: `ConversationList`, `MemberList`.
92
- - Reactions: `ReactionStrip`, `ReactionPicker`.
129
+ - Reactions and emoji: `ReactionStrip`, `ReactionPicker`, `EmojiPicker`.
93
130
  - Rooms and calls: `RoomJoinBar`, `RoomStage` (both take `useRoom()` from
94
131
  `@poolse/react`), `CallVideoGrid`, `CallControlButton`, `CallDeviceMenu`.
95
- - Identity and brand: `Avatar`, `UserName`, `useDisplayName`, `PoolseIcon`,
132
+ - Identity and brand: `Avatar`, `PresenceBadge`, `UserName`, `useDisplayName`, `PoolseIcon`,
96
133
  `PoolseLogo`, `PoolseFonts`, `usePoolseFonts`.
97
134
  - Theme: `PoolseTheme`, `useTheme`, `useSystemColorScheme`.
98
135