@poolse/react-ui 3.3.0 → 3.4.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,55 @@ 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.4.0] - 2026-11-21
8
+
9
+ ### Added
10
+
11
+ - `PoolseTheme` applies a `@poolse/theme` theme: `theme` takes a built-in id
12
+ (`coral`, `ocean`, `forest`, `grape`, `slate`, `sunset`, `rose`, `mono`) or a
13
+ `Theme`, `colorScheme` takes `'light' | 'dark' | 'system'` (default
14
+ `'system'`, follows the OS live). The theme's `--poolse-*` variables go on
15
+ the provider's own wrapper (`display: contents`), not `:root`; switching
16
+ restyles without remounting children. `useTheme()` returns
17
+ `{ theme: ResolvedTheme | null, colorScheme }`; `useSystemColorScheme()`.
18
+ - Re-exports `BUILT_IN_THEME_IDS`, `DEFAULT_THEME_ID`, `createTheme`,
19
+ `encodeTheme`, `decodeTheme` and the theme types from `@poolse/theme`.
20
+ - Stylesheet: a `[data-theme='light']` block, so a light-pinned subtree stays
21
+ light under a dark OS or a dark ancestor.
22
+ - `ConversationView` chat layouts: `layout="bubbles" | "list" | "compact"`
23
+ (default `bubbles`, unchanged). `list` is Slack-style — full-width
24
+ left-aligned rows, avatar + name + time once per run, later messages show
25
+ their time in the gutter on hover, a hover toolbar (React · Reply · Thread ·
26
+ More with Copy / Edit / Delete), "N replies" under thread roots. `compact` is
27
+ Discord/IRC-style — time, the name in the sender's `userColor`, and the text
28
+ on one line, small avatars only with `showAvatars`. Both mark messages that
29
+ @-mention the viewer with an accent bar and draw day dividers as a rule.
30
+ - `ConversationView` props `density` (`'comfortable' | 'compact'`),
31
+ `showAvatars` (overrides `avatars`; defaults `list` on, `compact` off),
32
+ `timeFormat` (`'12h' | '24h' | (date) => string`), `groupWindowMinutes`
33
+ (default 5), and `slots` — `header`, `body`, `attachments`, `reactions`,
34
+ `thread`, `actions`, each `(props) => ReactNode` receiving the message,
35
+ sender, layout, `isRunStart` and its default rendering as `children`; they
36
+ apply in every layout. Types `ChatLayout`, `ChatDensity`, `TimeFormat`,
37
+ `MessageSlots`, `MessageSlot`, `MessageSlotProps`, `RenderMessageContext`.
38
+ - `renderMessage` gets a third argument, `{ layout, groupPosition, isRunStart,
39
+ renderDefault }`; return `renderDefault()` to keep the built-in row.
40
+ - `MessageActions` `moreMenu` (Copy / Edit / Delete behind a "More" button);
41
+ `MessageBubble` `timeFormat`, `slots` / `slotContext`; `ThreadView` `layout`,
42
+ `timeFormat` (ConversationView passes its own).
43
+
44
+ ### Deprecated
45
+
46
+ - `ConversationView` `groupingWindowMs` — use `groupWindowMinutes` (still
47
+ honoured when that is unset).
48
+
49
+ ### Changed
50
+
51
+ - Bubbles, bubble links and the modal backdrop read the theme-only variables
52
+ `--poolse-own-bubble(-text)`, `--poolse-other-bubble(-text)`,
53
+ `--poolse-link`, `--poolse-overlay` and `--poolse-radius-bubble`, falling back
54
+ to the variables they read before — no visual change without a theme.
55
+
7
56
  ## [3.3.0] - 2026-11-20
8
57
 
9
58
  ### Added
package/README.md CHANGED
@@ -57,6 +57,27 @@ provider drops that conversation's badge. `focusMessageId` loads older pages
57
57
  until the message is there, scrolls to it and flashes it; a message it can't
58
58
  find shows a short notice and calls `onFocusMessageNotFound`.
59
59
 
60
+ ## Layouts
61
+
62
+ ```tsx
63
+ <ConversationView conversationId={id} layout="list" density="compact" timeFormat="24h" />
64
+ ```
65
+
66
+ - `layout="bubbles"` (default) — chat bubbles, yours on the right.
67
+ - `layout="list"` — Slack-style rows: avatar, name and time once per run of
68
+ messages (`groupWindowMinutes`, default 5), the time on hover for the rest, a
69
+ hover toolbar (React · Reply · Thread · More), "N replies" under threads.
70
+ - `layout="compact"` — Discord/IRC-style lines: time, the sender's name in
71
+ their colour, the text; `showAvatars` adds small avatars. Messages that
72
+ mention you get an accent bar (also in `list`).
73
+
74
+ Reactions, threads, quotes, edits, deletes, attachments, read receipts, typing,
75
+ the new-messages button, `focusMessageId` and `onSenderPress` /
76
+ `onAvatarPress` work the same in all three. To change one part of every
77
+ message, pass `slots={{ header, body, attachments, reactions, thread, actions }}`
78
+ — each is `(props) => ReactNode` and gets the default rendering as `children`.
79
+ `renderMessage(msg, meId, { layout, renderDefault })` replaces whole rows.
80
+
60
81
  ## Components
61
82
 
62
83
  - Composed: `PoolseInbox` (with a ref: `open`, `openDirect`, `openGroup`,
@@ -73,13 +94,34 @@ find shows a short notice and calls `onFocusMessageNotFound`.
73
94
  `@poolse/react`), `CallVideoGrid`, `CallControlButton`, `CallDeviceMenu`.
74
95
  - Identity and brand: `Avatar`, `UserName`, `useDisplayName`, `PoolseIcon`,
75
96
  `PoolseLogo`, `PoolseFonts`, `usePoolseFonts`.
97
+ - Theme: `PoolseTheme`, `useTheme`, `useSystemColorScheme`.
76
98
 
77
99
  Every `labelFor` / `avatarFor` takes your user id (`external_id`), except on
78
100
  `CallVideoGrid` and `RoomStage`, where it takes the poolse user id.
79
101
 
80
102
  ## Theming
81
103
 
82
- Override the `--poolse-*` CSS variables (`--poolse-brand`,
104
+ Wrap the UI in `PoolseTheme` to use one of the eight built-in themes from
105
+ [`@poolse/theme`](../theme) — `coral` (default), `ocean`, `forest`, `grape`,
106
+ `slate`, `sunset`, `rose`, `mono` — or your own:
107
+
108
+ ```tsx
109
+ import { PoolseTheme } from '@poolse/react-ui';
110
+
111
+ <PoolseTheme theme="ocean" colorScheme="system">
112
+ <PoolseInbox />
113
+ </PoolseTheme>;
114
+ ```
115
+
116
+ `theme` takes a built-in id or a `Theme` (`createTheme`, `decodeTheme` for a
117
+ shared theme code); `colorScheme` is `'light'`, `'dark'` or `'system'`
118
+ (default, follows the OS live). Changing either restyles in place — nothing
119
+ remounts. The variables are set on `PoolseTheme`'s own wrapper
120
+ (`display: contents`), not on `:root`, so differently themed chats can share a
121
+ page. `useTheme()` returns the active theme's tokens and scheme. Without
122
+ `theme`, nothing is set and the stylesheet's own colours apply.
123
+
124
+ Or override the `--poolse-*` CSS variables (`--poolse-brand`,
83
125
  `--poolse-brand-soft`, `--poolse-ink`, `--poolse-surface`,
84
126
  `--poolse-radius-md`, `--poolse-font-body`, …). Dark mode follows
85
127
  `prefers-color-scheme`; force it with `data-theme="dark"` or