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