@poolse/react-native 3.2.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/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var react$1 = require('@poolse/react');
4
4
  var react = require('react');
5
5
  var reactNative = require('react-native');
6
+ var theme = require('@poolse/theme');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
  var reactNativeSvg = require('react-native-svg');
8
9
  var reactNativeSafeAreaContext = require('react-native-safe-area-context');
@@ -179,28 +180,172 @@ var defaultDarkTheme = {
179
180
  spacing,
180
181
  shadows: darkShadows
181
182
  };
182
- var ThemeContext = react.createContext(null);
183
- function PoolseTheme({ mode, theme, children }) {
184
- const resolved = react.useMemo(() => {
185
- const base = (mode ?? theme?.mode) === "dark" ? defaultDarkTheme : defaultLightTheme;
186
- if (!theme) return base;
187
- return {
188
- mode: theme.mode ?? base.mode,
189
- colors: { ...base.colors, ...theme.colors },
190
- type: { ...base.type, ...theme.type },
191
- radii: { ...base.radii, ...theme.radii },
192
- spacing: { ...base.spacing, ...theme.spacing },
193
- shadows: {
194
- sm: { ...base.shadows.sm, ...theme.shadows?.sm },
195
- md: { ...base.shadows.md, ...theme.shadows?.md },
196
- lg: { ...base.shadows.lg, ...theme.shadows?.lg }
183
+ function legacyToNative(l) {
184
+ const c = l.colors;
185
+ return {
186
+ id: "default",
187
+ name: "Default",
188
+ scheme: l.mode,
189
+ colors: {
190
+ background: c.paper,
191
+ surface: c.surface,
192
+ surfaceAlt: c.surface2,
193
+ text: c.ink,
194
+ textMuted: c.ink2,
195
+ textSubtle: c.ink3,
196
+ border: c.border,
197
+ accent: c.brand,
198
+ accentText: c.onBrand,
199
+ accentSoft: c.brandSoft,
200
+ accentStrong: c.brandStrong,
201
+ // Links in other people's bubbles have always been brand-coloured.
202
+ link: c.brand,
203
+ sidebar: c.surface2,
204
+ sidebarText: c.ink,
205
+ sidebarActive: c.brandSoft,
206
+ sidebarActiveText: c.brandStrong,
207
+ badge: c.unreadPill,
208
+ badgeText: c.unreadPillText,
209
+ mention: c.brandSoft,
210
+ mentionText: c.brandStrong,
211
+ danger: c.error,
212
+ warning: c.warning,
213
+ success: c.success,
214
+ info: c.info,
215
+ presence: c.presence,
216
+ ownBubble: c.selfBubble,
217
+ ownBubbleText: c.selfBubbleText,
218
+ otherBubble: c.otherBubble,
219
+ otherBubbleText: c.otherBubbleText,
220
+ overlay: "#00000073"
221
+ },
222
+ fonts: {
223
+ body: l.type.fontBody,
224
+ display: l.type.fontDisplay,
225
+ mono: l.type.fontMono,
226
+ sizeXs: 11,
227
+ sizeSm: 13,
228
+ sizeMd: l.type.bodySize,
229
+ sizeLg: 17,
230
+ sizeXl: 20,
231
+ lineHeight: l.type.lineHeight
232
+ },
233
+ radii: { ...l.radii },
234
+ spacing: { ...l.spacing },
235
+ shadows: { sm: l.shadows.sm, md: l.shadows.md, lg: l.shadows.lg }
236
+ };
237
+ }
238
+ function nativeToLegacy(n) {
239
+ const c = n.colors;
240
+ return {
241
+ mode: n.scheme,
242
+ colors: {
243
+ brand: c.accent,
244
+ brandStrong: c.accentStrong,
245
+ brandSoft: c.accentSoft,
246
+ onBrand: c.accentText,
247
+ paper: c.background,
248
+ surface: c.surface,
249
+ surface2: c.surfaceAlt,
250
+ ink: c.text,
251
+ ink2: c.textMuted,
252
+ ink3: c.textSubtle,
253
+ border: c.border,
254
+ presence: c.presence,
255
+ success: c.success,
256
+ warning: c.warning,
257
+ error: c.danger,
258
+ info: c.info,
259
+ selfBubble: c.ownBubble,
260
+ selfBubbleText: c.ownBubbleText,
261
+ otherBubble: c.otherBubble,
262
+ otherBubbleText: c.otherBubbleText,
263
+ unreadPill: c.badge,
264
+ unreadPillText: c.badgeText
265
+ },
266
+ type: {
267
+ ...type,
268
+ fontDisplay: n.fonts.display,
269
+ fontBody: n.fonts.body,
270
+ fontMono: n.fonts.mono,
271
+ bodySize: n.fonts.sizeMd,
272
+ lineHeight: n.fonts.lineHeight
273
+ },
274
+ radii: { ...n.radii },
275
+ spacing: { ...n.spacing },
276
+ shadows: { ...n.shadows }
277
+ };
278
+ }
279
+ function isTheme(value) {
280
+ return typeof value === "object" && value !== null && "light" in value && "dark" in value && "id" in value;
281
+ }
282
+ function mergeLegacy(base, theme) {
283
+ return {
284
+ mode: theme.mode ?? base.mode,
285
+ colors: { ...base.colors, ...theme.colors },
286
+ type: { ...base.type, ...theme.type },
287
+ radii: { ...base.radii, ...theme.radii },
288
+ spacing: { ...base.spacing, ...theme.spacing },
289
+ shadows: {
290
+ sm: { ...base.shadows.sm, ...theme.shadows?.sm },
291
+ md: { ...base.shadows.md, ...theme.shadows?.md },
292
+ lg: { ...base.shadows.lg, ...theme.shadows?.lg }
293
+ }
294
+ };
295
+ }
296
+ function isNamedTheme(theme$1) {
297
+ return theme.isBuiltInThemeId(theme$1) || isTheme(theme$1);
298
+ }
299
+ function selectedScheme(selection, system) {
300
+ const { theme } = selection;
301
+ const named = isNamedTheme(theme);
302
+ const legacyMode = !named && theme ? theme.mode : void 0;
303
+ const preference = selection.colorScheme ?? selection.mode ?? legacyMode ?? (named ? "system" : "light");
304
+ return preference === "system" ? system : preference;
305
+ }
306
+ function resolveThemeValue(selection, scheme) {
307
+ const { theme: theme$1, fonts } = selection;
308
+ if (isNamedTheme(theme$1)) {
309
+ const native = theme.toNativeTheme(theme$1, scheme, {
310
+ fonts: {
311
+ ...fonts?.body ? { body: fonts.body } : {},
312
+ ...fonts?.display ? { display: fonts.display } : {},
313
+ ...fonts?.mono ? { mono: fonts.mono } : {}
197
314
  }
198
- };
199
- }, [mode, theme]);
200
- return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: resolved, children });
315
+ });
316
+ return { native, legacy: nativeToLegacy(native) };
317
+ }
318
+ const base = scheme === "dark" ? defaultDarkTheme : defaultLightTheme;
319
+ const legacy = theme$1 ? { ...mergeLegacy(base, theme$1), mode: scheme } : base;
320
+ return { native: legacyToNative(legacy), legacy };
321
+ }
322
+ var ThemeContext = react.createContext(null);
323
+ var FALLBACK = {
324
+ native: legacyToNative(defaultLightTheme)};
325
+ function PoolseTheme({ theme, colorScheme, mode, fonts, children }) {
326
+ const system = reactNative.useColorScheme() === "dark" ? "dark" : "light";
327
+ const scheme = selectedScheme({ theme, colorScheme, mode }, system);
328
+ const fontBody = fonts?.body;
329
+ const fontDisplay = fonts?.display;
330
+ const fontMono = fonts?.mono;
331
+ const value = react.useMemo(
332
+ () => resolveThemeValue(
333
+ {
334
+ theme,
335
+ fonts: {
336
+ ...fontBody ? { body: fontBody } : {},
337
+ ...fontDisplay ? { display: fontDisplay } : {},
338
+ ...fontMono ? { mono: fontMono } : {}
339
+ }
340
+ },
341
+ scheme
342
+ ),
343
+ [theme, scheme, fontBody, fontDisplay, fontMono]
344
+ );
345
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value, children });
201
346
  }
202
- function usePoolseTheme() {
203
- return react.useContext(ThemeContext) ?? defaultLightTheme;
347
+ function useTheme() {
348
+ return (react.useContext(ThemeContext) ?? FALLBACK).native;
204
349
  }
205
350
 
206
351
  // src/primitives/userColor.ts
@@ -229,13 +374,13 @@ function userColor(id) {
229
374
  }
230
375
  return PALETTE[Math.abs(h) % PALETTE.length];
231
376
  }
232
- var SIZES = { sm: 28, md: 40, lg: 56 };
377
+ var SIZES = { xs: 20, sm: 28, md: 40, lg: 56 };
233
378
  function Avatar({ src, name, seed, online, size = "md" }) {
234
- const theme = usePoolseTheme();
379
+ const theme = useTheme();
235
380
  const dim = SIZES[size];
236
381
  const initials = computeInitials(name);
237
- const tint = seed ? userColor(seed) : theme.colors.brand;
238
- const fontSize = size === "sm" ? 11 : size === "lg" ? 22 : 15;
382
+ const tint = seed ? userColor(seed) : theme.colors.accent;
383
+ const fontSize = size === "xs" ? 9 : size === "sm" ? 11 : size === "lg" ? 22 : 15;
239
384
  return /* @__PURE__ */ jsxRuntime.jsxs(
240
385
  reactNative.View,
241
386
  {
@@ -262,10 +407,10 @@ function Avatar({ src, name, seed, online, size = "md" }) {
262
407
  reactNative.Text,
263
408
  {
264
409
  style: {
265
- color: theme.colors.onBrand,
410
+ color: theme.colors.accentText,
266
411
  fontSize,
267
412
  fontWeight: "600",
268
- fontFamily: theme.type.fontBody
413
+ fontFamily: theme.fonts.body
269
414
  },
270
415
  children: initials
271
416
  }
@@ -572,10 +717,10 @@ var ICONS = {
572
717
  }
573
718
  };
574
719
  function PoolseIcon({ name, size = 20, color, label }) {
575
- const theme = usePoolseTheme();
720
+ const theme = useTheme();
576
721
  const def = ICONS[name];
577
722
  if (!def) return null;
578
- const stroke = color ?? theme.colors.ink;
723
+ const stroke = color ?? theme.colors.text;
579
724
  const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${def.vb}" fill="none" stroke="${stroke}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${def.d}</svg>`;
580
725
  const a11y = label === null ? { accessibilityRole: "none" } : { accessibilityRole: "image", accessibilityLabel: label ?? name };
581
726
  return /* @__PURE__ */ jsxRuntime.jsx(reactNativeSvg.SvgXml, { xml, width: size, height: size, ...a11y });
@@ -589,30 +734,30 @@ function MemberList({
589
734
  renderItem,
590
735
  emptyState
591
736
  }) {
592
- const theme = usePoolseTheme();
737
+ const theme = useTheme();
593
738
  const { members, loading, error, removeMember } = react$1.useMembers(conversationId);
594
739
  const { online: presenceOnline } = react$1.usePresence(
595
740
  onlineExternalIds === void 0 ? conversationId : ""
596
741
  );
597
742
  const effectiveOnline = onlineExternalIds ?? presenceOnline;
598
743
  if (loading && members.length === 0) {
599
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles2.placeholder, { backgroundColor: theme.colors.paper }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.brand }) });
744
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles2.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.accent }) });
600
745
  }
601
746
  if (error) {
602
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles2.placeholder, { backgroundColor: theme.colors.paper }], children: [
603
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.error, fontFamily: theme.type.fontBody }, children: "Failed to load members." }),
604
- error.message ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.errorDetail, { color: theme.colors.ink3 }], children: error.message }) : null
747
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles2.placeholder, { backgroundColor: theme.colors.background }], children: [
748
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.danger, fontFamily: theme.fonts.body }, children: "Failed to load members." }),
749
+ error.message ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.errorDetail, { color: theme.colors.textSubtle }], children: error.message }) : null
605
750
  ] });
606
751
  }
607
752
  if (members.length === 0) {
608
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles2.placeholder, { backgroundColor: theme.colors.paper }], children: typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.ink3, fontFamily: theme.type.fontBody }, children: emptyState ?? "No members." }) : emptyState });
753
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles2.placeholder, { backgroundColor: theme.colors.background }], children: typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState ?? "No members." }) : emptyState });
609
754
  }
610
755
  return /* @__PURE__ */ jsxRuntime.jsx(
611
756
  reactNative.FlatList,
612
757
  {
613
758
  data: members,
614
759
  keyExtractor: (m) => m.user_id,
615
- style: { backgroundColor: theme.colors.paper },
760
+ style: { backgroundColor: theme.colors.background },
616
761
  renderItem: ({ item }) => {
617
762
  if (renderItem) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderItem(item) });
618
763
  const isOnline = effectiveOnline.has(item.external_id);
@@ -640,7 +785,7 @@ function MemberRow({
640
785
  avatarFor,
641
786
  onRemove
642
787
  }) {
643
- const theme = usePoolseTheme();
788
+ const theme = useTheme();
644
789
  const resolved = react$1.useUser(externalId);
645
790
  const name = labelFor?.(externalId) ?? resolved.profile?.displayName ?? externalId;
646
791
  const avatarUrl = avatarFor?.(externalId) ?? resolved.profile?.avatarUrl ?? null;
@@ -650,14 +795,14 @@ function MemberRow({
650
795
  /* @__PURE__ */ jsxRuntime.jsx(
651
796
  reactNative.Text,
652
797
  {
653
- style: [styles2.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }],
798
+ style: [styles2.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
654
799
  numberOfLines: 1,
655
800
  children: name
656
801
  }
657
802
  ),
658
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.role, { color: theme.colors.ink3 }], children: role })
803
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.role, { color: theme.colors.textSubtle }], children: role })
659
804
  ] }),
660
- onRemove ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onRemove, hitSlop: 8, style: styles2.removeBtn, children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.ink2 }) }) : null
805
+ onRemove ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onRemove, hitSlop: 8, style: styles2.removeBtn, children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
661
806
  ] });
662
807
  }
663
808
  var styles2 = reactNative.StyleSheet.create({
@@ -752,7 +897,7 @@ function GroupDetailsSheet({
752
897
  avatarFor,
753
898
  canRemoveMember
754
899
  }) {
755
- const theme = usePoolseTheme();
900
+ const theme = useTheme();
756
901
  const { conversation } = react$1.useConversation(conversationId);
757
902
  const { members } = react$1.useMembers(conversationId);
758
903
  const insets = useSafeInsets();
@@ -786,7 +931,7 @@ function GroupDetailsSheet({
786
931
  style: [
787
932
  styles3.sheet,
788
933
  {
789
- backgroundColor: theme.colors.paper,
934
+ backgroundColor: theme.colors.background,
790
935
  borderTopLeftRadius: theme.radii.xl,
791
936
  borderTopRightRadius: theme.radii.xl,
792
937
  // Header stays below the status bar even on short screens.
@@ -799,16 +944,16 @@ function GroupDetailsSheet({
799
944
  theme.shadows.lg
800
945
  ],
801
946
  children: [
802
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ...panHandlers, style: styles3.dragHandle, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles3.dragPill, { backgroundColor: theme.colors.ink3 }] }) }),
947
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ...panHandlers, style: styles3.dragHandle, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles3.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
803
948
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.headerRow, children: [
804
949
  /* @__PURE__ */ jsxRuntime.jsx(
805
950
  reactNative.Pressable,
806
951
  {
807
952
  onPress: onClose,
808
953
  hitSlop: 16,
809
- style: [styles3.closeBtn, { backgroundColor: theme.colors.surface2 }],
954
+ style: [styles3.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
810
955
  accessibilityLabel: "Close",
811
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.ink })
956
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
812
957
  }
813
958
  ),
814
959
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -816,7 +961,7 @@ function GroupDetailsSheet({
816
961
  {
817
962
  style: [
818
963
  styles3.headerTitle,
819
- { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
964
+ { color: theme.colors.text, fontFamily: theme.fonts.display }
820
965
  ],
821
966
  children: "Group details"
822
967
  }
@@ -827,15 +972,12 @@ function GroupDetailsSheet({
827
972
  /* @__PURE__ */ jsxRuntime.jsx(
828
973
  reactNative.Text,
829
974
  {
830
- style: [
831
- styles3.title,
832
- { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
833
- ],
975
+ style: [styles3.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
834
976
  numberOfLines: 1,
835
977
  children: title
836
978
  }
837
979
  ),
838
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.subtitle, { color: theme.colors.ink3 }], children: subtitle })
980
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.subtitle, { color: theme.colors.textSubtle }], children: subtitle })
839
981
  ] }),
840
982
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles3.divider, { backgroundColor: theme.colors.border }] }),
841
983
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.sectionLabelRow, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -843,7 +985,7 @@ function GroupDetailsSheet({
843
985
  {
844
986
  style: [
845
987
  styles3.sectionLabel,
846
- { color: theme.colors.ink2, fontFamily: theme.type.fontBody }
988
+ { color: theme.colors.textMuted, fontFamily: theme.fonts.body }
847
989
  ],
848
990
  children: "Members"
849
991
  }
@@ -944,7 +1086,7 @@ function ChatHeader({
944
1086
  onPress,
945
1087
  onBack
946
1088
  }) {
947
- const theme = usePoolseTheme();
1089
+ const theme = useTheme();
948
1090
  const { conversation } = react$1.useConversation(conversationId);
949
1091
  const { members } = react$1.useMembers(conversationId);
950
1092
  const { me } = react$1.useMe();
@@ -991,18 +1133,18 @@ function ChatHeader({
991
1133
  }
992
1134
  ],
993
1135
  children: [
994
- onBack ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onBack, hitSlop: 12, style: styles4.backBtn, accessibilityLabel: "Back", children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.ink }) }) : null,
1136
+ onBack ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onBack, hitSlop: 12, style: styles4.backBtn, accessibilityLabel: "Back", children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.text }) }) : null,
995
1137
  /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: title, seed: avatarSeed, online: isOnline, size: "md" }),
996
1138
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles4.titleCol, children: [
997
1139
  /* @__PURE__ */ jsxRuntime.jsx(
998
1140
  reactNative.Text,
999
1141
  {
1000
- style: [styles4.title, { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }],
1142
+ style: [styles4.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
1001
1143
  numberOfLines: 1,
1002
1144
  children: title
1003
1145
  }
1004
1146
  ),
1005
- subtitle ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles4.subtitle, { color: theme.colors.ink3 }], numberOfLines: 1, children: subtitle }) : null
1147
+ subtitle ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles4.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: subtitle }) : null
1006
1148
  ] }),
1007
1149
  onMembersPress ? /* @__PURE__ */ jsxRuntime.jsx(
1008
1150
  reactNative.Pressable,
@@ -1011,7 +1153,7 @@ function ChatHeader({
1011
1153
  hitSlop: 12,
1012
1154
  style: styles4.actionBtn,
1013
1155
  accessibilityLabel: "Show members",
1014
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "users", size: 20, color: theme.colors.ink2 })
1156
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "users", size: 20, color: theme.colors.textMuted })
1015
1157
  }
1016
1158
  ) : null
1017
1159
  ]
@@ -1077,7 +1219,7 @@ function ConversationList({
1077
1219
  labelFor,
1078
1220
  avatarFor
1079
1221
  }) {
1080
- const theme = usePoolseTheme();
1222
+ const theme = useTheme();
1081
1223
  const auto = react$1.useConversations();
1082
1224
  const { me } = react$1.useMe();
1083
1225
  const meExternalId = me?.external_id ?? null;
@@ -1088,20 +1230,20 @@ function ConversationList({
1088
1230
  const error = isControlled ? controlledError ?? null : auto.error;
1089
1231
  const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
1090
1232
  if (loading && conversations.length === 0) {
1091
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.placeholder, { backgroundColor: theme.colors.paper }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.brand }) });
1233
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.accent }) });
1092
1234
  }
1093
1235
  if (error) {
1094
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.placeholder, { backgroundColor: theme.colors.paper }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.error, fontFamily: theme.type.fontBody }, children: "Failed to load conversations." }) });
1236
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.danger, fontFamily: theme.fonts.body }, children: "Failed to load conversations." }) });
1095
1237
  }
1096
1238
  if (conversations.length === 0) {
1097
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.placeholder, { backgroundColor: theme.colors.paper }], children: typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.ink3, fontFamily: theme.type.fontBody }, children: emptyState ?? "No conversations yet." }) : emptyState });
1239
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.placeholder, { backgroundColor: theme.colors.background }], children: typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState ?? "No conversations yet." }) : emptyState });
1098
1240
  }
1099
1241
  return /* @__PURE__ */ jsxRuntime.jsx(
1100
1242
  reactNative.FlatList,
1101
1243
  {
1102
1244
  data: conversations,
1103
1245
  keyExtractor: (c) => c.id,
1104
- style: { backgroundColor: theme.colors.paper },
1246
+ style: { backgroundColor: theme.colors.background },
1105
1247
  renderItem: ({ item }) => {
1106
1248
  const selected = selectedId === item.id;
1107
1249
  if (renderItem) {
@@ -1134,7 +1276,7 @@ function ConversationRow({
1134
1276
  avatarFor,
1135
1277
  onSelect
1136
1278
  }) {
1137
- const theme = usePoolseTheme();
1279
+ const theme = useTheme();
1138
1280
  const isDirect = conv.type === "direct";
1139
1281
  const otherExtId = isDirect && meExternalId ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId) ?? null : null;
1140
1282
  const resolvedOther = react$1.useUser(isDirect ? otherExtId : null);
@@ -1148,7 +1290,7 @@ function ConversationRow({
1148
1290
  style: [
1149
1291
  styles5.row,
1150
1292
  {
1151
- backgroundColor: selected ? theme.colors.surface2 : "transparent"
1293
+ backgroundColor: selected ? theme.colors.surfaceAlt : "transparent"
1152
1294
  }
1153
1295
  ],
1154
1296
  children: [
@@ -1157,14 +1299,14 @@ function ConversationRow({
1157
1299
  /* @__PURE__ */ jsxRuntime.jsx(
1158
1300
  reactNative.Text,
1159
1301
  {
1160
- style: [styles5.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }],
1302
+ style: [styles5.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
1161
1303
  numberOfLines: 1,
1162
1304
  children: title
1163
1305
  }
1164
1306
  ),
1165
- conv.last_message_preview ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.preview, { color: theme.colors.ink3 }], numberOfLines: 1, children: react$1.formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview }) : conv.last_message_at ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.preview, { color: theme.colors.ink3 }], numberOfLines: 1, children: formatRelative(conv.last_message_at) }) : null
1307
+ conv.last_message_preview ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.preview, { color: theme.colors.textSubtle }], numberOfLines: 1, children: react$1.formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview }) : conv.last_message_at ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.preview, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatRelative(conv.last_message_at) }) : null
1166
1308
  ] }),
1167
- unread > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.unreadPill, { backgroundColor: theme.colors.unreadPill }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.unreadText, { color: theme.colors.unreadPillText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
1309
+ unread > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
1168
1310
  ]
1169
1311
  }
1170
1312
  );
@@ -1255,7 +1397,7 @@ function AttachmentPicker({
1255
1397
  onPickInputs,
1256
1398
  camera = true
1257
1399
  }) {
1258
- const theme = usePoolseTheme();
1400
+ const theme = useTheme();
1259
1401
  const insets = useSafeInsets();
1260
1402
  const upload = useSharedUpload();
1261
1403
  const { setPreview } = useUploadPreview();
@@ -1302,18 +1444,18 @@ function AttachmentPicker({
1302
1444
  ],
1303
1445
  children: [
1304
1446
  camera ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { style: styles6.item, onPress: () => pickFromKind("camera"), children: [
1305
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "camera", size: 20, color: theme.colors.ink2 }),
1306
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.ink }], children: "Camera" })
1447
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "camera", size: 20, color: theme.colors.textMuted }),
1448
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.text }], children: "Camera" })
1307
1449
  ] }) : null,
1308
1450
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { style: styles6.item, onPress: () => pickFromKind("image"), children: [
1309
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "image", size: 20, color: theme.colors.ink2 }),
1310
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.ink }], children: "Photo or video" })
1451
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "image", size: 20, color: theme.colors.textMuted }),
1452
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.text }], children: "Photo or video" })
1311
1453
  ] }),
1312
1454
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { style: styles6.item, onPress: () => pickFromKind("document"), children: [
1313
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 20, color: theme.colors.ink2 }),
1314
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.ink }], children: "File" })
1455
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 20, color: theme.colors.textMuted }),
1456
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.text }], children: "File" })
1315
1457
  ] }),
1316
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles6.cancel, onPress: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.brand }], children: "Cancel" }) })
1458
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles6.cancel, onPress: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.itemText, { color: theme.colors.accent }], children: "Cancel" }) })
1317
1459
  ]
1318
1460
  }
1319
1461
  ) })
@@ -1491,39 +1633,53 @@ var styles6 = reactNative.StyleSheet.create({
1491
1633
  fontWeight: "500"
1492
1634
  }
1493
1635
  });
1494
- function DaySeparator({ label }) {
1495
- const theme = usePoolseTheme();
1496
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles7.wrap, children: /* @__PURE__ */ jsxRuntime.jsx(
1497
- reactNative.View,
1498
- {
1499
- style: [
1500
- styles7.chip,
1501
- {
1502
- backgroundColor: theme.colors.surface2,
1503
- borderColor: theme.colors.border
1504
- }
1505
- ],
1506
- children: /* @__PURE__ */ jsxRuntime.jsx(
1507
- reactNative.Text,
1508
- {
1509
- style: [
1510
- styles7.label,
1511
- {
1512
- color: theme.colors.ink2,
1513
- fontFamily: theme.type.fontBody
1514
- }
1515
- ],
1516
- children: label
1517
- }
1518
- )
1519
- }
1520
- ) });
1636
+ function DaySeparator({ label, variant = "pill" }) {
1637
+ const theme = useTheme();
1638
+ const rule = variant === "rule" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles7.rule, { backgroundColor: theme.colors.border }] }) : null;
1639
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles7.wrap, rule ? styles7.wrapRule : null], children: [
1640
+ rule,
1641
+ /* @__PURE__ */ jsxRuntime.jsx(
1642
+ reactNative.View,
1643
+ {
1644
+ style: [
1645
+ styles7.chip,
1646
+ {
1647
+ backgroundColor: theme.colors.surfaceAlt,
1648
+ borderColor: theme.colors.border
1649
+ }
1650
+ ],
1651
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1652
+ reactNative.Text,
1653
+ {
1654
+ style: [
1655
+ styles7.label,
1656
+ {
1657
+ color: theme.colors.textMuted,
1658
+ fontFamily: theme.fonts.body
1659
+ }
1660
+ ],
1661
+ children: label
1662
+ }
1663
+ )
1664
+ }
1665
+ ),
1666
+ rule
1667
+ ] });
1521
1668
  }
1522
1669
  var styles7 = reactNative.StyleSheet.create({
1523
1670
  wrap: {
1524
1671
  alignItems: "center",
1525
1672
  marginVertical: 8
1526
1673
  },
1674
+ wrapRule: {
1675
+ flexDirection: "row",
1676
+ gap: 10,
1677
+ paddingHorizontal: 12
1678
+ },
1679
+ rule: {
1680
+ flex: 1,
1681
+ height: reactNative.StyleSheet.hairlineWidth
1682
+ },
1527
1683
  chip: {
1528
1684
  paddingHorizontal: 12,
1529
1685
  paddingVertical: 4,
@@ -1537,7 +1693,7 @@ var styles7 = reactNative.StyleSheet.create({
1537
1693
  }
1538
1694
  });
1539
1695
  function LiveCallBanner({ call, inCall, onJoin }) {
1540
- const theme = usePoolseTheme();
1696
+ const theme = useTheme();
1541
1697
  const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
1542
1698
  const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
1543
1699
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1557,8 +1713,8 @@ function LiveCallBanner({ call, inCall, onJoin }) {
1557
1713
  }
1558
1714
  ),
1559
1715
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.text, children: [
1560
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.title, { fontFamily: theme.type.fontBody }], numberOfLines: 1, children: what }),
1561
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.meta, { fontFamily: theme.type.fontBody }], numberOfLines: 1, children: who })
1716
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.title, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: what }),
1717
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.meta, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: who })
1562
1718
  ] }),
1563
1719
  /* @__PURE__ */ jsxRuntime.jsx(
1564
1720
  reactNative.Pressable,
@@ -1571,10 +1727,7 @@ function LiveCallBanner({ call, inCall, onJoin }) {
1571
1727
  children: /* @__PURE__ */ jsxRuntime.jsx(
1572
1728
  reactNative.Text,
1573
1729
  {
1574
- style: [
1575
- styles8.joinText,
1576
- { color: theme.colors.success, fontFamily: theme.type.fontBody }
1577
- ],
1730
+ style: [styles8.joinText, { color: theme.colors.success, fontFamily: theme.fonts.body }],
1578
1731
  children: "Join"
1579
1732
  }
1580
1733
  )
@@ -1605,7 +1758,7 @@ var styles8 = reactNative.StyleSheet.create({
1605
1758
  joinText: { fontSize: 14, fontWeight: "700" }
1606
1759
  });
1607
1760
  function UploadQueueStrip() {
1608
- const theme = usePoolseTheme();
1761
+ const theme = useTheme();
1609
1762
  const upload = useSharedUpload();
1610
1763
  const { getPreview } = useUploadPreview();
1611
1764
  if (upload.queue.length === 0) return null;
@@ -1646,7 +1799,7 @@ function UploadQueueStrip() {
1646
1799
  children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 11, color: "#fff" })
1647
1800
  }
1648
1801
  ) : null,
1649
- isUploading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles9.progressOverlay, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.spinner, { borderColor: theme.colors.onBrand }] }) }) : null,
1802
+ isUploading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles9.progressOverlay, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.spinner, { borderColor: theme.colors.accentText }] }) }) : null,
1650
1803
  isError ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.errorOverlay, { backgroundColor: "rgba(229,72,77,0.85)" }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.errorText, { color: "#fff" }], children: "Failed" }) }) : null
1651
1804
  ] }, item.localId);
1652
1805
  })
@@ -1654,7 +1807,7 @@ function UploadQueueStrip() {
1654
1807
  );
1655
1808
  }
1656
1809
  function ImageTile({ uri, uploading, error }) {
1657
- const theme = usePoolseTheme();
1810
+ const theme = useTheme();
1658
1811
  return /* @__PURE__ */ jsxRuntime.jsx(
1659
1812
  reactNative.Image,
1660
1813
  {
@@ -1662,8 +1815,8 @@ function ImageTile({ uri, uploading, error }) {
1662
1815
  style: [
1663
1816
  styles9.imageTile,
1664
1817
  {
1665
- backgroundColor: theme.colors.surface2,
1666
- borderColor: error ? theme.colors.error : "transparent",
1818
+ backgroundColor: theme.colors.surfaceAlt,
1819
+ borderColor: error ? theme.colors.danger : "transparent",
1667
1820
  opacity: uploading ? 0.65 : 1
1668
1821
  }
1669
1822
  ],
@@ -1677,29 +1830,29 @@ function FileTile({
1677
1830
  uploading,
1678
1831
  error
1679
1832
  }) {
1680
- const theme = usePoolseTheme();
1833
+ const theme = useTheme();
1681
1834
  return /* @__PURE__ */ jsxRuntime.jsxs(
1682
1835
  reactNative.View,
1683
1836
  {
1684
1837
  style: [
1685
1838
  styles9.fileTile,
1686
1839
  {
1687
- backgroundColor: theme.colors.surface2,
1688
- borderColor: error ? theme.colors.error : uploading ? theme.colors.brand : theme.colors.border
1840
+ backgroundColor: theme.colors.surfaceAlt,
1841
+ borderColor: error ? theme.colors.danger : uploading ? theme.colors.accent : theme.colors.border
1689
1842
  }
1690
1843
  ],
1691
1844
  children: [
1692
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.fileIconBox, { backgroundColor: theme.colors.brandSoft }], children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.brand }) }),
1845
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.fileIconBox, { backgroundColor: theme.colors.accentSoft }], children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.accent }) }),
1693
1846
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.fileInfo, children: [
1694
1847
  /* @__PURE__ */ jsxRuntime.jsx(
1695
1848
  reactNative.Text,
1696
1849
  {
1697
- style: [styles9.fileName, { color: theme.colors.ink, fontFamily: theme.type.fontBody }],
1850
+ style: [styles9.fileName, { color: theme.colors.text, fontFamily: theme.fonts.body }],
1698
1851
  numberOfLines: 1,
1699
1852
  children: filename
1700
1853
  }
1701
1854
  ),
1702
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.fileSize, { color: theme.colors.ink3 }], children: formatBytes(size) })
1855
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.fileSize, { color: theme.colors.textSubtle }], children: formatBytes(size) })
1703
1856
  ] })
1704
1857
  ]
1705
1858
  }
@@ -1848,7 +2001,7 @@ var MessageComposer = react.forwardRef(
1848
2001
  onCancelEdit,
1849
2002
  onSaveEdit
1850
2003
  }, ref) {
1851
- const theme = usePoolseTheme();
2004
+ const theme = useTheme();
1852
2005
  const inputRef = react.useRef(null);
1853
2006
  const [value, setValue] = react.useState("");
1854
2007
  const [sending, setSending] = react.useState(false);
@@ -1948,7 +2101,7 @@ var MessageComposer = react.forwardRef(
1948
2101
  hitSlop: 8,
1949
2102
  style: styles10.iconBtn,
1950
2103
  accessibilityLabel: "Attach file",
1951
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 22, color: theme.colors.ink2 })
2104
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 22, color: theme.colors.textMuted })
1952
2105
  }
1953
2106
  ) : null,
1954
2107
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1961,17 +2114,17 @@ var MessageComposer = react.forwardRef(
1961
2114
  onTyping?.();
1962
2115
  },
1963
2116
  placeholder,
1964
- placeholderTextColor: theme.colors.ink3,
2117
+ placeholderTextColor: theme.colors.textSubtle,
1965
2118
  multiline: true,
1966
2119
  editable: !disabled,
1967
2120
  style: [
1968
2121
  styles10.input,
1969
2122
  {
1970
- color: theme.colors.ink,
1971
- backgroundColor: theme.colors.surface2,
2123
+ color: theme.colors.text,
2124
+ backgroundColor: theme.colors.surfaceAlt,
1972
2125
  borderRadius: theme.radii.lg,
1973
- fontFamily: theme.type.fontBody,
1974
- fontSize: theme.type.bodySize
2126
+ fontFamily: theme.fonts.body,
2127
+ fontSize: theme.fonts.sizeMd
1975
2128
  }
1976
2129
  ]
1977
2130
  }
@@ -1984,12 +2137,12 @@ var MessageComposer = react.forwardRef(
1984
2137
  style: [
1985
2138
  styles10.sendBtn,
1986
2139
  {
1987
- backgroundColor: submitDisabled ? theme.colors.ink3 : theme.colors.brand,
2140
+ backgroundColor: submitDisabled ? theme.colors.textSubtle : theme.colors.accent,
1988
2141
  opacity: submitDisabled ? 0.6 : 1
1989
2142
  }
1990
2143
  ],
1991
2144
  accessibilityLabel: "Send message",
1992
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "send", size: 18, color: theme.colors.onBrand })
2145
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "send", size: 18, color: theme.colors.accentText })
1993
2146
  }
1994
2147
  )
1995
2148
  ] })
@@ -1999,23 +2152,23 @@ var MessageComposer = react.forwardRef(
1999
2152
  }
2000
2153
  );
2001
2154
  function EditChip({ message, onCancel }) {
2002
- const theme = usePoolseTheme();
2155
+ const theme = useTheme();
2003
2156
  return /* @__PURE__ */ jsxRuntime.jsxs(
2004
2157
  reactNative.View,
2005
2158
  {
2006
2159
  style: [
2007
2160
  styles10.replyChip,
2008
2161
  {
2009
- backgroundColor: theme.colors.surface2,
2010
- borderLeftColor: theme.colors.brand
2162
+ backgroundColor: theme.colors.surfaceAlt,
2163
+ borderLeftColor: theme.colors.accent
2011
2164
  }
2012
2165
  ],
2013
2166
  children: [
2014
2167
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1 }, children: [
2015
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.replyName, { color: theme.colors.brand }], children: "Editing message" }),
2016
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.replyBody, { color: theme.colors.ink2 }], numberOfLines: 1, children: message.body ?? "\u2026" })
2168
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.replyName, { color: theme.colors.accent }], children: "Editing message" }),
2169
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
2017
2170
  ] }),
2018
- onCancel ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.ink2 }) }) : null
2171
+ onCancel ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
2019
2172
  ]
2020
2173
  }
2021
2174
  );
@@ -2025,7 +2178,7 @@ function ReplyChip({
2025
2178
  labelFor,
2026
2179
  onCancel
2027
2180
  }) {
2028
- const theme = usePoolseTheme();
2181
+ const theme = useTheme();
2029
2182
  const resolved = react$1.useUser(message.sender_external_id);
2030
2183
  const senderName = message.sender_external_id ? labelFor?.(message.sender_external_id) ?? resolved.profile?.displayName ?? message.sender_external_id : "Unknown";
2031
2184
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2034,19 +2187,19 @@ function ReplyChip({
2034
2187
  style: [
2035
2188
  styles10.replyChip,
2036
2189
  {
2037
- backgroundColor: theme.colors.surface2,
2038
- borderLeftColor: theme.colors.brand
2190
+ backgroundColor: theme.colors.surfaceAlt,
2191
+ borderLeftColor: theme.colors.accent
2039
2192
  }
2040
2193
  ],
2041
2194
  children: [
2042
2195
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1 }, children: [
2043
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles10.replyName, { color: theme.colors.brand }], children: [
2196
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles10.replyName, { color: theme.colors.accent }], children: [
2044
2197
  "Replying to ",
2045
2198
  senderName
2046
2199
  ] }),
2047
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.replyBody, { color: theme.colors.ink2 }], numberOfLines: 1, children: message.body ?? "\u2026" })
2200
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
2048
2201
  ] }),
2049
- onCancel ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.ink2 }) }) : null
2202
+ onCancel ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
2050
2203
  ]
2051
2204
  }
2052
2205
  );
@@ -2109,7 +2262,7 @@ var styles10 = reactNative.StyleSheet.create({
2109
2262
  }
2110
2263
  });
2111
2264
  function MentionInput({ conversationId, onSend, ...composerProps }) {
2112
- const theme = usePoolseTheme();
2265
+ const theme = useTheme();
2113
2266
  const insets = useSafeInsets();
2114
2267
  const keyboardOpen = useKeyboardOpen();
2115
2268
  const { members } = react$1.useMembers(conversationId);
@@ -2171,7 +2324,7 @@ function MentionInput({ conversationId, onSend, ...composerProps }) {
2171
2324
  /* @__PURE__ */ jsxRuntime.jsx(
2172
2325
  reactNative.Text,
2173
2326
  {
2174
- style: [styles11.title, { color: theme.colors.ink, fontFamily: theme.type.fontBody }],
2327
+ style: [styles11.title, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2175
2328
  children: "Mention a member"
2176
2329
  }
2177
2330
  ),
@@ -2202,10 +2355,10 @@ function MentionInput({ conversationId, onSend, ...composerProps }) {
2202
2355
  ] });
2203
2356
  }
2204
2357
  function MentionRow({ member, onPress }) {
2205
- const theme = usePoolseTheme();
2358
+ const theme = useTheme();
2206
2359
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { onPress, style: styles11.row, children: [
2207
2360
  /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: null, name: member.external_id, seed: member.external_id, size: "sm" }),
2208
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.rowText, { color: theme.colors.ink, fontFamily: theme.type.fontBody }], children: member.external_id })
2361
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.rowText, { color: theme.colors.text, fontFamily: theme.fonts.body }], children: member.external_id })
2209
2362
  ] });
2210
2363
  }
2211
2364
  var styles11 = reactNative.StyleSheet.create({
@@ -2238,6 +2391,18 @@ var styles11 = reactNative.StyleSheet.create({
2238
2391
  fontSize: 14
2239
2392
  }
2240
2393
  });
2394
+
2395
+ // src/internal/messageFocus.ts
2396
+ function latestMarkableId(messages) {
2397
+ const latest = messages[messages.length - 1];
2398
+ if (!latest?.id) return null;
2399
+ if (typeof latest.sequence !== "number" || latest.sequence <= 0) return null;
2400
+ if (latest.sequence === Number.MAX_SAFE_INTEGER) return null;
2401
+ return latest.id;
2402
+ }
2403
+ function indexOfMessage(items, messageId) {
2404
+ return items.findIndex((it) => it.kind === "msg" && it.msg?.id === messageId);
2405
+ }
2241
2406
  var AT_BOTTOM_THRESHOLD = 32;
2242
2407
  function MessageList({
2243
2408
  messages,
@@ -2249,9 +2414,11 @@ function MessageList({
2249
2414
  ListHeader = null,
2250
2415
  ListFooter = null,
2251
2416
  emptyState,
2252
- meId = null
2417
+ meId = null,
2418
+ scrollToMessageId = null,
2419
+ scrollRequest = 0
2253
2420
  }) {
2254
- const theme = usePoolseTheme();
2421
+ const theme = useTheme();
2255
2422
  const flatListRef = react.useRef(null);
2256
2423
  const [atBottom, setAtBottom] = react.useState(true);
2257
2424
  const [newCount, setNewCount] = react.useState(0);
@@ -2278,6 +2445,34 @@ function MessageList({
2278
2445
  setAtBottom((prev) => prev === next ? prev : next);
2279
2446
  if (next) setNewCount(0);
2280
2447
  }, []);
2448
+ const dataRef = react.useRef(data);
2449
+ dataRef.current = data;
2450
+ const scrollRetriesRef = react.useRef(0);
2451
+ react.useEffect(() => {
2452
+ if (!scrollToMessageId) return;
2453
+ const index = indexOfMessage(dataRef.current, scrollToMessageId);
2454
+ if (index === -1) return;
2455
+ scrollRetriesRef.current = 0;
2456
+ flatListRef.current?.scrollToIndex({ index, animated: true, viewPosition: 0.5 });
2457
+ }, [scrollToMessageId, scrollRequest]);
2458
+ const onScrollToIndexFailed = react.useCallback(
2459
+ (info) => {
2460
+ flatListRef.current?.scrollToOffset({
2461
+ offset: info.averageItemLength * info.index,
2462
+ animated: false
2463
+ });
2464
+ if (scrollRetriesRef.current >= 3) return;
2465
+ scrollRetriesRef.current += 1;
2466
+ setTimeout(() => {
2467
+ flatListRef.current?.scrollToIndex({
2468
+ index: info.index,
2469
+ animated: true,
2470
+ viewPosition: 0.5
2471
+ });
2472
+ }, 120);
2473
+ },
2474
+ []
2475
+ );
2281
2476
  const scrollToBottom = react.useCallback(() => {
2282
2477
  flatListRef.current?.scrollToOffset({ offset: 0, animated: true });
2283
2478
  setNewCount(0);
@@ -2291,10 +2486,10 @@ function MessageList({
2291
2486
  [renderItem, data.length]
2292
2487
  );
2293
2488
  if (loading && messages.length === 0) {
2294
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles12.placeholder, { backgroundColor: theme.colors.paper }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.brand }) });
2489
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles12.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.accent }) });
2295
2490
  }
2296
2491
  if (messages.length === 0) {
2297
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles12.placeholder, { backgroundColor: theme.colors.paper }], children: typeof emptyState === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.ink3, fontFamily: theme.type.fontBody }, children: emptyState }) : emptyState ?? null });
2492
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles12.placeholder, { backgroundColor: theme.colors.background }], children: typeof emptyState === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState }) : emptyState ?? null });
2298
2493
  }
2299
2494
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.root, children: [
2300
2495
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2307,14 +2502,15 @@ function MessageList({
2307
2502
  renderItem: handleRender,
2308
2503
  onEndReached: hasMore ? onLoadMore : void 0,
2309
2504
  onEndReachedThreshold: 0.3,
2505
+ onScrollToIndexFailed,
2310
2506
  onScroll: handleScroll,
2311
2507
  scrollEventThrottle: 32,
2312
2508
  ListHeaderComponent: ListHeader,
2313
2509
  ListFooterComponent: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
2314
- hasMore && loading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.ink3, style: { marginVertical: 8 } }) : null,
2510
+ hasMore && loading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.textSubtle, style: { marginVertical: 8 } }) : null,
2315
2511
  ListFooter
2316
2512
  ] }),
2317
- style: { backgroundColor: theme.colors.paper },
2513
+ style: { backgroundColor: theme.colors.background },
2318
2514
  contentContainerStyle: { paddingVertical: 8 }
2319
2515
  }
2320
2516
  ),
@@ -2325,14 +2521,14 @@ function MessageList({
2325
2521
  style: [
2326
2522
  styles12.jumpButton,
2327
2523
  {
2328
- backgroundColor: theme.colors.brand
2524
+ backgroundColor: theme.colors.accent
2329
2525
  },
2330
2526
  theme.shadows.sm
2331
2527
  ],
2332
2528
  accessibilityLabel: `${newCount} new ${newCount === 1 ? "message" : "messages"}, jump to latest`,
2333
2529
  children: [
2334
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "chevron-down", size: 14, color: theme.colors.onBrand }),
2335
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles12.jumpText, { color: theme.colors.onBrand }], children: [
2530
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "chevron-down", size: 14, color: theme.colors.accentText }),
2531
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles12.jumpText, { color: theme.colors.accentText }], children: [
2336
2532
  newCount,
2337
2533
  " new ",
2338
2534
  newCount === 1 ? "message" : "messages"
@@ -2369,13 +2565,13 @@ var styles12 = reactNative.StyleSheet.create({
2369
2565
  }
2370
2566
  });
2371
2567
  function CallLogRow({ msg, meId, onCallBack }) {
2372
- const theme = usePoolseTheme();
2568
+ const theme = useTheme();
2373
2569
  const display = react$1.callLogDisplayFor(msg, meId);
2374
2570
  if (!display) return null;
2375
- const accent = display.missed ? theme.colors.error : theme.colors.ink3;
2571
+ const accent = display.missed ? theme.colors.danger : theme.colors.textSubtle;
2376
2572
  const time = formatTime(msg.inserted_at);
2377
2573
  const label = [display.title, display.detail, time].filter(Boolean).join(", ");
2378
- const metaStyle = [styles13.meta, { color: theme.colors.ink3, fontFamily: theme.type.fontBody }];
2574
+ const metaStyle = [styles13.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
2379
2575
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.wrap, accessible: true, accessibilityLabel: label, children: [
2380
2576
  /* @__PURE__ */ jsxRuntime.jsxs(
2381
2577
  reactNative.View,
@@ -2383,7 +2579,7 @@ function CallLogRow({ msg, meId, onCallBack }) {
2383
2579
  style: [
2384
2580
  styles13.chip,
2385
2581
  {
2386
- backgroundColor: theme.colors.surface2,
2582
+ backgroundColor: theme.colors.surfaceAlt,
2387
2583
  borderColor: theme.colors.border
2388
2584
  }
2389
2585
  ],
@@ -2395,8 +2591,8 @@ function CallLogRow({ msg, meId, onCallBack }) {
2395
2591
  style: [
2396
2592
  styles13.title,
2397
2593
  {
2398
- color: display.missed ? theme.colors.error : theme.colors.ink2,
2399
- fontFamily: theme.type.fontBody
2594
+ color: display.missed ? theme.colors.danger : theme.colors.textMuted,
2595
+ fontFamily: theme.fonts.body
2400
2596
  }
2401
2597
  ],
2402
2598
  numberOfLines: 1,
@@ -2427,7 +2623,7 @@ function CallLogRow({ msg, meId, onCallBack }) {
2427
2623
  {
2428
2624
  style: [
2429
2625
  styles13.callBackText,
2430
- { color: theme.colors.brand, fontFamily: theme.type.fontBody }
2626
+ { color: theme.colors.accent, fontFamily: theme.fonts.body }
2431
2627
  ],
2432
2628
  children: "Call back"
2433
2629
  }
@@ -2475,149 +2671,13 @@ var styles13 = reactNative.StyleSheet.create({
2475
2671
  fontVariant: ["tabular-nums"]
2476
2672
  }
2477
2673
  });
2478
- var DEFAULT_REACTION_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F64F}", "\u{1F525}"];
2479
- function MessageActions({
2480
- visible,
2481
- onClose,
2482
- isSelf,
2483
- emojis = DEFAULT_REACTION_EMOJIS,
2484
- onPickReaction,
2485
- onReply,
2486
- onReplyInThread,
2487
- onQuote,
2488
- onEdit,
2489
- onDelete,
2490
- onCopy
2491
- }) {
2492
- const theme = usePoolseTheme();
2493
- const insets = useSafeInsets();
2494
- const items = [];
2495
- if (onReply) items.push({ label: "Reply", icon: "reply", onPress: onReply });
2496
- if (onQuote) items.push({ label: "Quote reply", icon: "reply", onPress: onQuote });
2497
- if (onReplyInThread)
2498
- items.push({ label: "Reply in thread", icon: "messages", onPress: onReplyInThread });
2499
- if (onCopy) items.push({ label: "Copy text", icon: "copy", onPress: onCopy });
2500
- if (isSelf && onEdit) items.push({ label: "Edit", icon: "edit", onPress: onEdit });
2501
- if (isSelf && onDelete)
2502
- items.push({ label: "Delete", icon: "trash", onPress: onDelete, danger: true });
2503
- const showEmojiRow = !!onPickReaction && emojis.length > 0;
2504
- return /* @__PURE__ */ jsxRuntime.jsx(
2505
- reactNative.Modal,
2506
- {
2507
- visible,
2508
- transparent: true,
2509
- animationType: "fade",
2510
- onRequestClose: onClose,
2511
- ...EDGE_TO_EDGE_MODAL,
2512
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles14.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(
2513
- reactNative.View,
2514
- {
2515
- style: [
2516
- styles14.sheet,
2517
- {
2518
- backgroundColor: theme.colors.surface,
2519
- borderTopLeftRadius: theme.radii.lg,
2520
- borderTopRightRadius: theme.radii.lg,
2521
- // Last action row must sit above the nav bar / home indicator.
2522
- paddingBottom: 24 + insets.bottom,
2523
- paddingLeft: insets.left,
2524
- paddingRight: insets.right
2525
- },
2526
- theme.shadows.lg
2527
- ],
2528
- children: [
2529
- showEmojiRow ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles14.emojiRow, { borderBottomColor: theme.colors.border }], children: emojis.map((emoji) => /* @__PURE__ */ jsxRuntime.jsx(
2530
- reactNative.Pressable,
2531
- {
2532
- onPress: () => {
2533
- onPickReaction(emoji);
2534
- onClose();
2535
- },
2536
- style: styles14.emojiBtn,
2537
- hitSlop: 6,
2538
- accessibilityLabel: `React with ${emoji}`,
2539
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles14.emoji, children: emoji })
2540
- },
2541
- emoji
2542
- )) }) : null,
2543
- items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { onPress: item.onPress, style: styles14.item, children: [
2544
- /* @__PURE__ */ jsxRuntime.jsx(
2545
- PoolseIcon,
2546
- {
2547
- name: item.icon,
2548
- size: 18,
2549
- color: item.danger ? theme.colors.error : theme.colors.ink2
2550
- }
2551
- ),
2552
- /* @__PURE__ */ jsxRuntime.jsx(
2553
- reactNative.Text,
2554
- {
2555
- style: [
2556
- styles14.itemText,
2557
- {
2558
- color: item.danger ? theme.colors.error : theme.colors.ink,
2559
- fontFamily: theme.type.fontBody
2560
- }
2561
- ],
2562
- children: item.label
2563
- }
2564
- )
2565
- ] }, item.label))
2566
- ]
2567
- }
2568
- ) })
2569
- }
2570
- );
2571
- }
2572
- var styles14 = reactNative.StyleSheet.create({
2573
- backdrop: {
2574
- flex: 1,
2575
- backgroundColor: "rgba(0,0,0,0.35)",
2576
- justifyContent: "flex-end"
2577
- },
2578
- sheet: {
2579
- paddingTop: 8,
2580
- paddingBottom: 24
2581
- },
2582
- emojiRow: {
2583
- flexDirection: "row",
2584
- alignItems: "center",
2585
- justifyContent: "space-around",
2586
- paddingHorizontal: 12,
2587
- paddingVertical: 10,
2588
- borderBottomWidth: reactNative.StyleSheet.hairlineWidth,
2589
- marginBottom: 6
2590
- },
2591
- emojiBtn: {
2592
- paddingHorizontal: 6,
2593
- paddingVertical: 6,
2594
- borderRadius: 999,
2595
- alignItems: "center",
2596
- justifyContent: "center"
2597
- },
2598
- emoji: {
2599
- fontSize: 30,
2600
- lineHeight: 36
2601
- },
2602
- item: {
2603
- flexDirection: "row",
2604
- alignItems: "center",
2605
- paddingHorizontal: 20,
2606
- paddingVertical: 14,
2607
- gap: 14
2608
- },
2609
- itemText: {
2610
- fontSize: 15,
2611
- fontWeight: "500"
2612
- }
2613
- });
2614
2674
  function AttachmentPreview({
2615
2675
  attachment,
2616
2676
  onPress,
2617
2677
  maxWidth = 280,
2618
2678
  tone = "default"
2619
2679
  }) {
2620
- const theme = usePoolseTheme();
2680
+ const theme = useTheme();
2621
2681
  const isImage = (attachment.content_type ?? "").startsWith("image/");
2622
2682
  const { url } = react$1.useAttachmentUrl(attachment.id);
2623
2683
  if (isImage) {
@@ -2629,7 +2689,7 @@ function AttachmentPreview({
2629
2689
  width: maxWidth,
2630
2690
  height: 200,
2631
2691
  borderRadius: theme.radii.md,
2632
- backgroundColor: theme.colors.surface2
2692
+ backgroundColor: theme.colors.surfaceAlt
2633
2693
  },
2634
2694
  resizeMode: "cover",
2635
2695
  accessible: true,
@@ -2639,45 +2699,45 @@ function AttachmentPreview({
2639
2699
  reactNative.View,
2640
2700
  {
2641
2701
  style: [
2642
- styles15.imagePlaceholder,
2702
+ styles14.imagePlaceholder,
2643
2703
  {
2644
2704
  width: maxWidth,
2645
2705
  height: 200,
2646
2706
  borderRadius: theme.radii.md,
2647
- backgroundColor: theme.colors.surface2
2707
+ backgroundColor: theme.colors.surfaceAlt
2648
2708
  }
2649
2709
  ]
2650
2710
  }
2651
2711
  ) });
2652
2712
  }
2653
2713
  const onBrand = tone === "onBrand";
2654
- const ink = onBrand ? theme.colors.onBrand : theme.colors.ink;
2655
- const inkSoft = onBrand ? theme.colors.onBrand : theme.colors.ink3;
2714
+ const ink = onBrand ? theme.colors.ownBubbleText : theme.colors.text;
2715
+ const inkSoft = onBrand ? theme.colors.ownBubbleText : theme.colors.textSubtle;
2656
2716
  return /* @__PURE__ */ jsxRuntime.jsxs(
2657
2717
  reactNative.Pressable,
2658
2718
  {
2659
2719
  onPress,
2660
2720
  disabled: !onPress,
2661
2721
  style: [
2662
- styles15.fileCard,
2722
+ styles14.fileCard,
2663
2723
  {
2664
- backgroundColor: onBrand ? "rgba(255,255,255,0.18)" : theme.colors.surface2,
2724
+ backgroundColor: onBrand ? "rgba(255,255,255,0.18)" : theme.colors.surfaceAlt,
2665
2725
  borderColor: onBrand ? "transparent" : theme.colors.border,
2666
2726
  borderRadius: theme.radii.md
2667
2727
  }
2668
2728
  ],
2669
2729
  children: [
2670
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 18, color: onBrand ? ink : theme.colors.ink2 }),
2730
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 18, color: onBrand ? ink : theme.colors.textMuted }),
2671
2731
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1, marginLeft: 8 }, children: [
2672
2732
  /* @__PURE__ */ jsxRuntime.jsx(
2673
2733
  reactNative.Text,
2674
2734
  {
2675
- style: [styles15.fileName, { color: ink, fontFamily: theme.type.fontBody }],
2735
+ style: [styles14.fileName, { color: ink, fontFamily: theme.fonts.body }],
2676
2736
  numberOfLines: 1,
2677
2737
  children: attachment.original_filename ?? "file"
2678
2738
  }
2679
2739
  ),
2680
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes2(attachment.byte_size) })
2740
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes2(attachment.byte_size) })
2681
2741
  ] })
2682
2742
  ]
2683
2743
  }
@@ -2689,7 +2749,7 @@ function formatBytes2(n) {
2689
2749
  if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;
2690
2750
  return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
2691
2751
  }
2692
- var styles15 = reactNative.StyleSheet.create({
2752
+ var styles14 = reactNative.StyleSheet.create({
2693
2753
  imagePlaceholder: {},
2694
2754
  fileCard: {
2695
2755
  flexDirection: "row",
@@ -2712,7 +2772,7 @@ function ImageMosaic({
2712
2772
  squareBottom = false,
2713
2773
  onLongPress
2714
2774
  }) {
2715
- const theme = usePoolseTheme();
2775
+ const theme = useTheme();
2716
2776
  const r = radius ?? theme.radii.md;
2717
2777
  const rBottom = squareBottom ? 5 : r;
2718
2778
  const [viewerIndex, setViewerIndex] = react.useState(null);
@@ -2725,7 +2785,7 @@ function ImageMosaic({
2725
2785
  reactNative.View,
2726
2786
  {
2727
2787
  style: [
2728
- styles16.root,
2788
+ styles15.root,
2729
2789
  {
2730
2790
  borderTopLeftRadius: r,
2731
2791
  borderTopRightRadius: r,
@@ -2746,18 +2806,18 @@ function ImageMosaic({
2746
2806
  {
2747
2807
  onLongPress,
2748
2808
  attachment: visible[0],
2749
- style: styles16.tileFull,
2809
+ style: styles15.tileFull,
2750
2810
  onPress: () => setViewerIndex(0),
2751
2811
  overlay: null
2752
2812
  }
2753
2813
  ) : null,
2754
- n === 2 ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.rowEven, children: [
2814
+ n === 2 ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.rowEven, children: [
2755
2815
  /* @__PURE__ */ jsxRuntime.jsx(
2756
2816
  Tile,
2757
2817
  {
2758
2818
  onLongPress,
2759
2819
  attachment: visible[0],
2760
- style: styles16.tileHalfSquare,
2820
+ style: styles15.tileHalfSquare,
2761
2821
  onPress: () => setViewerIndex(0),
2762
2822
  overlay: null
2763
2823
  }
@@ -2767,7 +2827,7 @@ function ImageMosaic({
2767
2827
  {
2768
2828
  onLongPress,
2769
2829
  attachment: visible[1],
2770
- style: styles16.tileHalfSquare,
2830
+ style: styles15.tileHalfSquare,
2771
2831
  onPress: () => setViewerIndex(1),
2772
2832
  overlay: null
2773
2833
  }
@@ -2779,18 +2839,18 @@ function ImageMosaic({
2779
2839
  {
2780
2840
  onLongPress,
2781
2841
  attachment: visible[0],
2782
- style: styles16.tileHero,
2842
+ style: styles15.tileHero,
2783
2843
  onPress: () => setViewerIndex(0),
2784
2844
  overlay: null
2785
2845
  }
2786
2846
  ),
2787
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.rowEven, { marginTop: 2 }], children: [
2847
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles15.rowEven, { marginTop: 2 }], children: [
2788
2848
  /* @__PURE__ */ jsxRuntime.jsx(
2789
2849
  Tile,
2790
2850
  {
2791
2851
  onLongPress,
2792
2852
  attachment: visible[1],
2793
- style: styles16.tileHalfSquare,
2853
+ style: styles15.tileHalfSquare,
2794
2854
  onPress: () => setViewerIndex(1),
2795
2855
  overlay: null
2796
2856
  }
@@ -2800,7 +2860,7 @@ function ImageMosaic({
2800
2860
  {
2801
2861
  onLongPress,
2802
2862
  attachment: visible[2],
2803
- style: styles16.tileHalfSquare,
2863
+ style: styles15.tileHalfSquare,
2804
2864
  onPress: () => setViewerIndex(2),
2805
2865
  overlay: null
2806
2866
  }
@@ -2808,13 +2868,13 @@ function ImageMosaic({
2808
2868
  ] })
2809
2869
  ] }) : null,
2810
2870
  n === 4 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2811
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.rowEven, children: [
2871
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.rowEven, children: [
2812
2872
  /* @__PURE__ */ jsxRuntime.jsx(
2813
2873
  Tile,
2814
2874
  {
2815
2875
  onLongPress,
2816
2876
  attachment: visible[0],
2817
- style: styles16.tileHalfSquare,
2877
+ style: styles15.tileHalfSquare,
2818
2878
  onPress: () => setViewerIndex(0),
2819
2879
  overlay: null
2820
2880
  }
@@ -2824,19 +2884,19 @@ function ImageMosaic({
2824
2884
  {
2825
2885
  onLongPress,
2826
2886
  attachment: visible[1],
2827
- style: styles16.tileHalfSquare,
2887
+ style: styles15.tileHalfSquare,
2828
2888
  onPress: () => setViewerIndex(1),
2829
2889
  overlay: null
2830
2890
  }
2831
2891
  )
2832
2892
  ] }),
2833
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.rowEven, { marginTop: 2 }], children: [
2893
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles15.rowEven, { marginTop: 2 }], children: [
2834
2894
  /* @__PURE__ */ jsxRuntime.jsx(
2835
2895
  Tile,
2836
2896
  {
2837
2897
  onLongPress,
2838
2898
  attachment: visible[2],
2839
- style: styles16.tileHalfSquare,
2899
+ style: styles15.tileHalfSquare,
2840
2900
  onPress: () => setViewerIndex(2),
2841
2901
  overlay: null
2842
2902
  }
@@ -2846,7 +2906,7 @@ function ImageMosaic({
2846
2906
  {
2847
2907
  onLongPress,
2848
2908
  attachment: visible[3],
2849
- style: styles16.tileHalfSquare,
2909
+ style: styles15.tileHalfSquare,
2850
2910
  onPress: () => setViewerIndex(3),
2851
2911
  overlay: overflow > 0 ? `+${overflow}` : null
2852
2912
  }
@@ -2882,20 +2942,20 @@ function Tile({
2882
2942
  onPress,
2883
2943
  onLongPress
2884
2944
  }) {
2885
- const theme = usePoolseTheme();
2945
+ const theme = useTheme();
2886
2946
  const { url } = react$1.useAttachmentUrl(attachment.id);
2887
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { onPress, onLongPress, style: [styles16.tileBase, style], children: [
2947
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { onPress, onLongPress, style: [styles15.tileBase, style], children: [
2888
2948
  url ? /* @__PURE__ */ jsxRuntime.jsx(
2889
2949
  reactNative.Image,
2890
2950
  {
2891
2951
  source: { uri: url },
2892
- style: [styles16.tileImage, { backgroundColor: theme.colors.surface2 }],
2952
+ style: [styles15.tileImage, { backgroundColor: theme.colors.surfaceAlt }],
2893
2953
  resizeMode: "cover",
2894
2954
  accessible: true,
2895
2955
  accessibilityLabel: attachment.original_filename ?? "image"
2896
2956
  }
2897
- ) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles16.tileImage, { backgroundColor: theme.colors.surface2 }] }),
2898
- overlay ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles16.overflow, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles16.overflowText, children: overlay }) }) : null
2957
+ ) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles15.tileImage, { backgroundColor: theme.colors.surfaceAlt }] }),
2958
+ overlay ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles15.overflow, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles15.overflowText, children: overlay }) }) : null
2899
2959
  ] });
2900
2960
  }
2901
2961
  function FullScreenViewer({
@@ -2905,7 +2965,7 @@ function FullScreenViewer({
2905
2965
  const { url } = react$1.useAttachmentUrl(attachment.id);
2906
2966
  const { width, height } = reactNative.useWindowDimensions();
2907
2967
  const insets = useSafeInsets();
2908
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { style: styles16.viewer, onPress: onClose, children: [
2968
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { style: styles15.viewer, onPress: onClose, children: [
2909
2969
  url ? /* @__PURE__ */ jsxRuntime.jsx(
2910
2970
  reactNative.Image,
2911
2971
  {
@@ -2921,14 +2981,14 @@ function FullScreenViewer({
2921
2981
  {
2922
2982
  onPress: onClose,
2923
2983
  hitSlop: 12,
2924
- style: [styles16.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
2984
+ style: [styles15.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
2925
2985
  accessibilityLabel: "Close viewer",
2926
2986
  children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 20, color: "#ffffff" })
2927
2987
  }
2928
2988
  )
2929
2989
  ] });
2930
2990
  }
2931
- var styles16 = reactNative.StyleSheet.create({
2991
+ var styles15 = reactNative.StyleSheet.create({
2932
2992
  root: {
2933
2993
  width: "100%",
2934
2994
  overflow: "hidden",
@@ -3054,53 +3114,219 @@ function renderMarkdown(body, args) {
3054
3114
  };
3055
3115
  return react.createElement(Markdown__default.default, { style, markdownit, onLinkPress: args.onLinkPress }, body);
3056
3116
  }
3057
- function MessageBubble({
3058
- message,
3059
- currentUserId,
3060
- readState,
3061
- labelFor,
3062
- onQuotedClick,
3063
- groupPosition = "standalone",
3064
- maxBodyLength = 0,
3065
- showSenderName = false,
3066
- actionsTrigger,
3067
- showAttachments = true,
3068
- markdown = true,
3069
- onLongPress
3070
- }) {
3071
- const theme = usePoolseTheme();
3072
- const { width: screenWidth } = reactNative.useWindowDimensions();
3073
- const isSelf = currentUserId !== null && message.sender_id === currentUserId;
3074
- const [expanded, setExpanded] = react.useState(false);
3075
- const [lastLineWidth, setLastLineWidth] = react.useState(null);
3076
- const [textBoxWidth, setTextBoxWidth] = react.useState(null);
3077
- const [metaWidth, setMetaWidth] = react.useState(null);
3078
- const bubbleMaxWidth = Math.floor(screenWidth * 0.78);
3079
- const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);
3080
- const sender = react$1.useUser(!isSelf ? message.sender_external_id : null);
3081
- const senderFallbackName = message.sender_external_id ?? "Unknown";
3082
- const senderLabel = sender.profile?.displayName ?? (message.sender_external_id ? labelFor?.(message.sender_external_id) ?? senderFallbackName : senderFallbackName);
3083
- const senderTint = userColor(message.sender_external_id ?? message.sender_id ?? message.id);
3084
- const tailCorner = groupPosition === "last" || groupPosition === "standalone";
3085
- const bubbleRadius = theme.radii.bubble;
3086
- const textColor = isSelf ? theme.colors.selfBubbleText : theme.colors.otherBubbleText;
3087
- const mutedOnBubble = isSelf ? theme.colors.onBrand : theme.colors.ink3;
3088
- const radii2 = {
3089
- topLeft: bubbleRadius,
3090
- topRight: bubbleRadius,
3091
- bottomLeft: bubbleRadius,
3092
- bottomRight: bubbleRadius
3093
- };
3094
- if (tailCorner) {
3095
- if (isSelf) radii2.bottomRight = 5;
3096
- else radii2.bottomLeft = 5;
3117
+
3118
+ // src/layout.ts
3119
+ function formatClock(date, format2) {
3120
+ if (typeof format2 === "function") return format2(date);
3121
+ if (format2 === "12h") {
3122
+ return date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit", hour12: true });
3097
3123
  }
3098
- const body = message.body ?? "";
3099
- const isDeleted = !!message.deleted_at;
3100
- const isEdited = !!message.edited_at && !isDeleted;
3101
- const trimmable = maxBodyLength > 0 && body.length > maxBodyLength;
3124
+ if (format2 === "24h") {
3125
+ return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
3126
+ }
3127
+ return date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
3128
+ }
3129
+ function formatMessageTime(iso, format2) {
3130
+ if (!iso) return "";
3131
+ const date = new Date(iso);
3132
+ if (Number.isNaN(date.getTime())) return "";
3133
+ return formatClock(date, format2);
3134
+ }
3135
+ function mentionsViewer(msg, meId) {
3136
+ return meId !== null && msg.sender_id !== meId && (msg.mentions ?? []).includes(meId);
3137
+ }
3138
+ function renderSlot(slot, ctx, children) {
3139
+ return slot && ctx ? slot({ ...ctx, children }) : children;
3140
+ }
3141
+ var DEFAULT_REACTION_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F64F}", "\u{1F525}"];
3142
+ function MessageActions({
3143
+ visible,
3144
+ onClose,
3145
+ isSelf,
3146
+ emojis = DEFAULT_REACTION_EMOJIS,
3147
+ onPickReaction,
3148
+ onReply,
3149
+ onReplyInThread,
3150
+ onQuote,
3151
+ onEdit,
3152
+ onDelete,
3153
+ onCopy
3154
+ }) {
3155
+ const theme = useTheme();
3156
+ const insets = useSafeInsets();
3157
+ const items = [];
3158
+ if (onReply) items.push({ label: "Reply", icon: "reply", onPress: onReply });
3159
+ if (onQuote) items.push({ label: "Quote reply", icon: "reply", onPress: onQuote });
3160
+ if (onReplyInThread)
3161
+ items.push({ label: "Reply in thread", icon: "messages", onPress: onReplyInThread });
3162
+ if (onCopy) items.push({ label: "Copy text", icon: "copy", onPress: onCopy });
3163
+ if (isSelf && onEdit) items.push({ label: "Edit", icon: "edit", onPress: onEdit });
3164
+ if (isSelf && onDelete)
3165
+ items.push({ label: "Delete", icon: "trash", onPress: onDelete, danger: true });
3166
+ const showEmojiRow = !!onPickReaction && emojis.length > 0;
3167
+ return /* @__PURE__ */ jsxRuntime.jsx(
3168
+ reactNative.Modal,
3169
+ {
3170
+ visible,
3171
+ transparent: true,
3172
+ animationType: "fade",
3173
+ onRequestClose: onClose,
3174
+ ...EDGE_TO_EDGE_MODAL,
3175
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles16.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(
3176
+ reactNative.View,
3177
+ {
3178
+ style: [
3179
+ styles16.sheet,
3180
+ {
3181
+ backgroundColor: theme.colors.surface,
3182
+ borderTopLeftRadius: theme.radii.lg,
3183
+ borderTopRightRadius: theme.radii.lg,
3184
+ // Last action row must sit above the nav bar / home indicator.
3185
+ paddingBottom: 24 + insets.bottom,
3186
+ paddingLeft: insets.left,
3187
+ paddingRight: insets.right
3188
+ },
3189
+ theme.shadows.lg
3190
+ ],
3191
+ children: [
3192
+ showEmojiRow ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles16.emojiRow, { borderBottomColor: theme.colors.border }], children: emojis.map((emoji) => /* @__PURE__ */ jsxRuntime.jsx(
3193
+ reactNative.Pressable,
3194
+ {
3195
+ onPress: () => {
3196
+ onPickReaction(emoji);
3197
+ onClose();
3198
+ },
3199
+ style: styles16.emojiBtn,
3200
+ hitSlop: 6,
3201
+ accessibilityLabel: `React with ${emoji}`,
3202
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles16.emoji, children: emoji })
3203
+ },
3204
+ emoji
3205
+ )) }) : null,
3206
+ items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { onPress: item.onPress, style: styles16.item, children: [
3207
+ /* @__PURE__ */ jsxRuntime.jsx(
3208
+ PoolseIcon,
3209
+ {
3210
+ name: item.icon,
3211
+ size: 18,
3212
+ color: item.danger ? theme.colors.danger : theme.colors.textMuted
3213
+ }
3214
+ ),
3215
+ /* @__PURE__ */ jsxRuntime.jsx(
3216
+ reactNative.Text,
3217
+ {
3218
+ style: [
3219
+ styles16.itemText,
3220
+ {
3221
+ color: item.danger ? theme.colors.danger : theme.colors.text,
3222
+ fontFamily: theme.fonts.body
3223
+ }
3224
+ ],
3225
+ children: item.label
3226
+ }
3227
+ )
3228
+ ] }, item.label))
3229
+ ]
3230
+ }
3231
+ ) })
3232
+ }
3233
+ );
3234
+ }
3235
+ var styles16 = reactNative.StyleSheet.create({
3236
+ backdrop: {
3237
+ flex: 1,
3238
+ backgroundColor: "rgba(0,0,0,0.35)",
3239
+ justifyContent: "flex-end"
3240
+ },
3241
+ sheet: {
3242
+ paddingTop: 8,
3243
+ paddingBottom: 24
3244
+ },
3245
+ emojiRow: {
3246
+ flexDirection: "row",
3247
+ alignItems: "center",
3248
+ justifyContent: "space-around",
3249
+ paddingHorizontal: 12,
3250
+ paddingVertical: 10,
3251
+ borderBottomWidth: reactNative.StyleSheet.hairlineWidth,
3252
+ marginBottom: 6
3253
+ },
3254
+ emojiBtn: {
3255
+ paddingHorizontal: 6,
3256
+ paddingVertical: 6,
3257
+ borderRadius: 999,
3258
+ alignItems: "center",
3259
+ justifyContent: "center"
3260
+ },
3261
+ emoji: {
3262
+ fontSize: 30,
3263
+ lineHeight: 36
3264
+ },
3265
+ item: {
3266
+ flexDirection: "row",
3267
+ alignItems: "center",
3268
+ paddingHorizontal: 20,
3269
+ paddingVertical: 14,
3270
+ gap: 14
3271
+ },
3272
+ itemText: {
3273
+ fontSize: 15,
3274
+ fontWeight: "500"
3275
+ }
3276
+ });
3277
+ function MessageBubble({
3278
+ message,
3279
+ currentUserId,
3280
+ readState,
3281
+ labelFor,
3282
+ onQuotedClick,
3283
+ groupPosition = "standalone",
3284
+ maxBodyLength = 0,
3285
+ showSenderName = false,
3286
+ onSenderPress,
3287
+ actionsTrigger,
3288
+ showAttachments = true,
3289
+ markdown = true,
3290
+ onLongPress,
3291
+ timeFormat,
3292
+ density = "comfortable",
3293
+ slots,
3294
+ slotContext
3295
+ }) {
3296
+ const dense = density === "compact";
3297
+ const theme = useTheme();
3298
+ const { width: screenWidth } = reactNative.useWindowDimensions();
3299
+ const isSelf = currentUserId !== null && message.sender_id === currentUserId;
3300
+ const [expanded, setExpanded] = react.useState(false);
3301
+ const [lastLineWidth, setLastLineWidth] = react.useState(null);
3302
+ const [textBoxWidth, setTextBoxWidth] = react.useState(null);
3303
+ const [metaWidth, setMetaWidth] = react.useState(null);
3304
+ const bubbleMaxWidth = Math.floor(screenWidth * 0.78);
3305
+ const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);
3306
+ const sender = react$1.useUser(!isSelf ? message.sender_external_id : null);
3307
+ const senderFallbackName = message.sender_external_id ?? "Unknown";
3308
+ const senderLabel = sender.profile?.displayName ?? (message.sender_external_id ? labelFor?.(message.sender_external_id) ?? senderFallbackName : senderFallbackName);
3309
+ const senderTint = userColor(message.sender_external_id ?? message.sender_id ?? message.id);
3310
+ const tailCorner = groupPosition === "last" || groupPosition === "standalone";
3311
+ const bubbleRadius = theme.radii.bubble;
3312
+ const textColor = isSelf ? theme.colors.ownBubbleText : theme.colors.otherBubbleText;
3313
+ const mutedOnBubble = isSelf ? theme.colors.ownBubbleText : theme.colors.textSubtle;
3314
+ const radii2 = {
3315
+ topLeft: bubbleRadius,
3316
+ topRight: bubbleRadius,
3317
+ bottomLeft: bubbleRadius,
3318
+ bottomRight: bubbleRadius
3319
+ };
3320
+ if (tailCorner) {
3321
+ if (isSelf) radii2.bottomRight = 5;
3322
+ else radii2.bottomLeft = 5;
3323
+ }
3324
+ const body = message.body ?? "";
3325
+ const isDeleted = !!message.deleted_at;
3326
+ const isEdited = !!message.edited_at && !isDeleted;
3327
+ const trimmable = maxBodyLength > 0 && body.length > maxBodyLength;
3102
3328
  const truncated = trimmable && !expanded ? body.slice(0, maxBodyLength) + "\u2026" : body;
3103
- const time = formatTime2(message.inserted_at);
3329
+ const time = formatTime2(message.inserted_at, timeFormat);
3104
3330
  const images = showAttachments && !isDeleted ? (message.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
3105
3331
  const files = showAttachments && !isDeleted ? (message.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
3106
3332
  const hasMedia = images.length > 0;
@@ -3112,13 +3338,14 @@ function MessageBubble({
3112
3338
  const sectionAbove = hasMedia || hasFiles || !!message.quoted_message || isDeleted;
3113
3339
  const metaFits = lastLineWidth !== null && textBoxWidth !== null && metaWidth !== null && lastLineWidth + metaWidth + 14 <= textBoxWidth;
3114
3340
  const metaRow = (variant) => {
3115
- const color = variant === "overlay" ? "#FFFFFF" : variant === "jumbo" ? theme.colors.ink3 : mutedOnBubble;
3341
+ const color = variant === "overlay" ? "#FFFFFF" : variant === "jumbo" ? theme.colors.textSubtle : mutedOnBubble;
3116
3342
  return /* @__PURE__ */ jsxRuntime.jsxs(
3117
3343
  reactNative.View,
3118
3344
  {
3119
3345
  style: [
3120
3346
  styles17.metaRow,
3121
3347
  variant === "inline" && styles17.metaInline,
3348
+ variant === "inline" && dense && styles17.metaInlineDense,
3122
3349
  variant === "wrapped" && styles17.metaWrapped,
3123
3350
  variant === "overlay" && styles17.metaOverlay,
3124
3351
  variant === "block" && styles17.metaBlock,
@@ -3144,141 +3371,188 @@ function MessageBubble({
3144
3371
  }
3145
3372
  );
3146
3373
  };
3147
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles17.wrap, { alignSelf: isSelf ? "flex-end" : "flex-start", maxWidth: bubbleMaxWidth }], children: [
3148
- /* @__PURE__ */ jsxRuntime.jsxs(
3149
- reactNative.View,
3150
- {
3151
- style: [
3152
- jumboCount === 0 && {
3153
- backgroundColor: isSelf ? theme.colors.selfBubble : theme.colors.otherBubble,
3154
- borderColor: isSelf ? "transparent" : theme.colors.border,
3155
- borderWidth: isSelf ? 0 : reactNative.StyleSheet.hairlineWidth,
3156
- borderTopLeftRadius: radii2.topLeft,
3157
- borderTopRightRadius: radii2.topRight,
3158
- borderBottomLeftRadius: radii2.bottomLeft,
3159
- borderBottomRightRadius: radii2.bottomRight
3160
- },
3161
- jumboCount === 0 && theme.shadows.sm
3162
- ],
3163
- children: [
3164
- showSenderName && !isSelf && jumboCount === 0 && (groupPosition === "first" || groupPosition === "standalone") ? /* @__PURE__ */ jsxRuntime.jsx(
3165
- reactNative.Text,
3166
- {
3167
- style: [styles17.senderName, { color: senderTint, fontFamily: theme.type.fontBody }],
3168
- children: senderLabel
3169
- }
3170
- ) : null,
3171
- message.quoted_message ? /* @__PURE__ */ jsxRuntime.jsx(
3172
- QuotedCard,
3173
- {
3174
- quoted: message.quoted_message,
3175
- isSelf,
3176
- ...labelFor ? { labelFor } : {},
3177
- ...onQuotedClick ? { onPress: () => onQuotedClick(message.quoted_message.id) } : {}
3178
- }
3179
- ) : null,
3180
- hasMedia ? (
3181
- // 3px of bubble color framing the picture; the mosaic clips
3182
- // itself 3px tighter than the bubble so the curves stay
3183
- // concentric.
3184
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.mediaFrame, children: [
3185
- /* @__PURE__ */ jsxRuntime.jsx(
3186
- ImageMosaic,
3187
- {
3188
- images,
3189
- maxWidth: mediaWidth,
3190
- radius: Math.max(bubbleRadius - 3, 8),
3191
- squareBottom: !metaOverlay,
3192
- ...onLongPress ? { onLongPress } : {}
3193
- }
3194
- ),
3195
- metaOverlay ? metaRow("overlay") : null
3196
- ] })
3197
- ) : null,
3198
- hasFiles ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.filesBlock, children: files.map((att) => /* @__PURE__ */ jsxRuntime.jsx(
3199
- AttachmentPreview,
3200
- {
3201
- attachment: att,
3202
- maxWidth: bubbleMaxWidth - 12,
3203
- tone: isSelf ? "onBrand" : "default"
3204
- },
3205
- att.id
3206
- )) }) : null,
3207
- isDeleted ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles17.textBlock, sectionAbove && styles17.textBlockAfter], children: /* @__PURE__ */ jsxRuntime.jsx(
3208
- reactNative.Text,
3209
- {
3210
- style: {
3211
- color: mutedOnBubble,
3212
- opacity: 0.7,
3213
- fontFamily: theme.type.fontBody,
3214
- fontSize: theme.type.bodySize,
3215
- lineHeight: theme.type.lineHeight,
3216
- fontStyle: "italic"
3374
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3375
+ reactNative.View,
3376
+ {
3377
+ style: [
3378
+ styles17.wrap,
3379
+ { alignSelf: isSelf ? "flex-end" : "flex-start", maxWidth: bubbleMaxWidth }
3380
+ ],
3381
+ children: [
3382
+ /* @__PURE__ */ jsxRuntime.jsxs(
3383
+ reactNative.View,
3384
+ {
3385
+ style: [
3386
+ jumboCount === 0 && {
3387
+ backgroundColor: isSelf ? theme.colors.ownBubble : theme.colors.otherBubble,
3388
+ borderColor: isSelf ? "transparent" : theme.colors.border,
3389
+ borderWidth: isSelf ? 0 : reactNative.StyleSheet.hairlineWidth,
3390
+ borderTopLeftRadius: radii2.topLeft,
3391
+ borderTopRightRadius: radii2.topRight,
3392
+ borderBottomLeftRadius: radii2.bottomLeft,
3393
+ borderBottomRightRadius: radii2.bottomRight
3217
3394
  },
3218
- children: "Message deleted"
3219
- }
3220
- ) }) : null,
3221
- hasBody && jumboCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.jumboBlock, children: /* @__PURE__ */ jsxRuntime.jsx(
3222
- reactNative.Text,
3223
- {
3224
- style: { fontSize: emojiFontSize(jumboCount), lineHeight: emojiFontSize(jumboCount) + 8 },
3225
- children: body
3226
- }
3227
- ) }) : null,
3228
- hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
3229
- reactNative.View,
3230
- {
3231
- style: [styles17.textBlock, sectionAbove && styles17.textBlockAfter],
3232
- onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
3233
- children: [
3234
- markdown && !inlineMeta ? renderMarkdown(truncated, {
3235
- textColor,
3236
- linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,
3237
- fontFamily: theme.type.fontBody,
3238
- fontSize: theme.type.bodySize,
3239
- lineHeight: theme.type.lineHeight,
3240
- onLinkPress: (url) => {
3241
- void reactNative.Linking.openURL(url).catch(() => void 0);
3242
- return false;
3243
- }
3244
- }) : /* @__PURE__ */ jsxRuntime.jsx(
3245
- reactNative.Text,
3246
- {
3247
- style: {
3248
- color: textColor,
3249
- fontFamily: theme.type.fontBody,
3250
- fontSize: theme.type.bodySize,
3251
- lineHeight: theme.type.lineHeight
3252
- },
3253
- onTextLayout: inlineMeta ? (e) => {
3254
- const lines = e.nativeEvent.lines;
3255
- const last = lines[lines.length - 1];
3256
- setLastLineWidth(last ? Math.ceil(last.width) : 0);
3257
- } : void 0,
3258
- children: truncated
3259
- }
3260
- ),
3261
- trimmable ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsxRuntime.jsx(
3395
+ jumboCount === 0 && theme.shadows.sm
3396
+ ],
3397
+ children: [
3398
+ renderSlot(
3399
+ slots?.header,
3400
+ slotContext,
3401
+ showSenderName && !isSelf && jumboCount === 0 && (groupPosition === "first" || groupPosition === "standalone") ? /* @__PURE__ */ jsxRuntime.jsx(
3262
3402
  reactNative.Text,
3263
3403
  {
3264
- style: [
3265
- styles17.readMore,
3266
- { color: isSelf ? theme.colors.onBrand : theme.colors.brand }
3267
- ],
3268
- children: expanded ? "Show less" : "Read more"
3404
+ style: [styles17.senderName, { color: senderTint, fontFamily: theme.fonts.body }],
3405
+ ...onSenderPress ? {
3406
+ onPress: onSenderPress,
3407
+ accessibilityRole: "button",
3408
+ suppressHighlighting: true
3409
+ } : {},
3410
+ children: senderLabel
3269
3411
  }
3270
- ) }) : null,
3271
- inlineMeta ? metaRow(metaFits ? "inline" : "wrapped") : null
3272
- ]
3273
- }
3274
- ) : null,
3275
- !inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
3276
- actionsTrigger ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.actionsSlot, children: actionsTrigger }) : null
3277
- ]
3278
- }
3279
- ),
3280
- jumboCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { alignSelf: isSelf ? "flex-end" : "flex-start" }, children: metaRow("jumbo") }) : null
3281
- ] });
3412
+ ) : null
3413
+ ),
3414
+ message.quoted_message ? /* @__PURE__ */ jsxRuntime.jsx(
3415
+ QuotedCard,
3416
+ {
3417
+ quoted: message.quoted_message,
3418
+ isSelf,
3419
+ ...labelFor ? { labelFor } : {},
3420
+ ...onQuotedClick ? { onPress: () => onQuotedClick(message.quoted_message.id) } : {}
3421
+ }
3422
+ ) : null,
3423
+ renderSlot(
3424
+ slots?.attachments,
3425
+ slotContext,
3426
+ hasMedia || hasFiles ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3427
+ hasMedia ? (
3428
+ // 3px of bubble color framing the picture; the mosaic clips
3429
+ // itself 3px tighter than the bubble so the curves stay
3430
+ // concentric.
3431
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.mediaFrame, children: [
3432
+ /* @__PURE__ */ jsxRuntime.jsx(
3433
+ ImageMosaic,
3434
+ {
3435
+ images,
3436
+ maxWidth: mediaWidth,
3437
+ radius: Math.max(bubbleRadius - 3, 8),
3438
+ squareBottom: !metaOverlay,
3439
+ ...onLongPress ? { onLongPress } : {}
3440
+ }
3441
+ ),
3442
+ metaOverlay ? metaRow("overlay") : null
3443
+ ] })
3444
+ ) : null,
3445
+ hasFiles ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.filesBlock, children: files.map((att) => /* @__PURE__ */ jsxRuntime.jsx(
3446
+ AttachmentPreview,
3447
+ {
3448
+ attachment: att,
3449
+ maxWidth: bubbleMaxWidth - 12,
3450
+ tone: isSelf ? "onBrand" : "default"
3451
+ },
3452
+ att.id
3453
+ )) }) : null
3454
+ ] }) : null
3455
+ ),
3456
+ renderSlot(
3457
+ slots?.body,
3458
+ slotContext,
3459
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3460
+ isDeleted ? /* @__PURE__ */ jsxRuntime.jsx(
3461
+ reactNative.View,
3462
+ {
3463
+ style: [
3464
+ styles17.textBlock,
3465
+ dense && styles17.textBlockDense,
3466
+ sectionAbove && styles17.textBlockAfter
3467
+ ],
3468
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3469
+ reactNative.Text,
3470
+ {
3471
+ style: {
3472
+ color: mutedOnBubble,
3473
+ opacity: 0.7,
3474
+ fontFamily: theme.fonts.body,
3475
+ fontSize: theme.fonts.sizeMd,
3476
+ lineHeight: theme.fonts.lineHeight,
3477
+ fontStyle: "italic"
3478
+ },
3479
+ children: "Message deleted"
3480
+ }
3481
+ )
3482
+ }
3483
+ ) : null,
3484
+ hasBody && jumboCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.jumboBlock, children: /* @__PURE__ */ jsxRuntime.jsx(
3485
+ reactNative.Text,
3486
+ {
3487
+ style: {
3488
+ fontSize: emojiFontSize(jumboCount),
3489
+ lineHeight: emojiFontSize(jumboCount) + 8
3490
+ },
3491
+ children: body
3492
+ }
3493
+ ) }) : null,
3494
+ hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
3495
+ reactNative.View,
3496
+ {
3497
+ style: [
3498
+ styles17.textBlock,
3499
+ dense && styles17.textBlockDense,
3500
+ sectionAbove && styles17.textBlockAfter
3501
+ ],
3502
+ onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
3503
+ children: [
3504
+ markdown && !inlineMeta ? renderMarkdown(truncated, {
3505
+ textColor,
3506
+ linkColor: isSelf ? theme.colors.ownBubbleText : theme.colors.link,
3507
+ fontFamily: theme.fonts.body,
3508
+ fontSize: theme.fonts.sizeMd,
3509
+ lineHeight: theme.fonts.lineHeight,
3510
+ onLinkPress: (url) => {
3511
+ void reactNative.Linking.openURL(url).catch(() => void 0);
3512
+ return false;
3513
+ }
3514
+ }) : /* @__PURE__ */ jsxRuntime.jsx(
3515
+ reactNative.Text,
3516
+ {
3517
+ style: {
3518
+ color: textColor,
3519
+ fontFamily: theme.fonts.body,
3520
+ fontSize: theme.fonts.sizeMd,
3521
+ lineHeight: theme.fonts.lineHeight
3522
+ },
3523
+ onTextLayout: inlineMeta ? (e) => {
3524
+ const lines = e.nativeEvent.lines;
3525
+ const last = lines[lines.length - 1];
3526
+ setLastLineWidth(last ? Math.ceil(last.width) : 0);
3527
+ } : void 0,
3528
+ children: truncated
3529
+ }
3530
+ ),
3531
+ trimmable ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsxRuntime.jsx(
3532
+ reactNative.Text,
3533
+ {
3534
+ style: [
3535
+ styles17.readMore,
3536
+ { color: isSelf ? theme.colors.ownBubbleText : theme.colors.link }
3537
+ ],
3538
+ children: expanded ? "Show less" : "Read more"
3539
+ }
3540
+ ) }) : null,
3541
+ inlineMeta ? metaRow(metaFits ? "inline" : "wrapped") : null
3542
+ ]
3543
+ }
3544
+ ) : null
3545
+ ] })
3546
+ ),
3547
+ !inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
3548
+ actionsTrigger ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.actionsSlot, children: actionsTrigger }) : null
3549
+ ]
3550
+ }
3551
+ ),
3552
+ jumboCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { alignSelf: isSelf ? "flex-end" : "flex-start" }, children: metaRow("jumbo") }) : null
3553
+ ]
3554
+ }
3555
+ );
3282
3556
  }
3283
3557
  function QuotedCard({
3284
3558
  quoted,
@@ -3286,12 +3560,12 @@ function QuotedCard({
3286
3560
  labelFor,
3287
3561
  onPress
3288
3562
  }) {
3289
- const theme = usePoolseTheme();
3563
+ const theme = useTheme();
3290
3564
  const resolved = react$1.useUser(quoted.sender_external_id);
3291
3565
  const senderName = quoted.sender_external_id ? labelFor?.(quoted.sender_external_id) ?? resolved.profile?.displayName ?? quoted.sender_external_id : "Unknown";
3292
- const bg = isSelf ? "rgba(0,0,0,0.16)" : theme.colors.surface2;
3293
- const accent = isSelf ? theme.colors.onBrand : theme.colors.brand;
3294
- const txt = isSelf ? theme.colors.onBrand : theme.colors.ink;
3566
+ const bg = isSelf ? "rgba(0,0,0,0.16)" : theme.colors.surfaceAlt;
3567
+ const accent = isSelf ? theme.colors.ownBubbleText : theme.colors.accent;
3568
+ const txt = isSelf ? theme.colors.ownBubbleText : theme.colors.text;
3295
3569
  return /* @__PURE__ */ jsxRuntime.jsxs(
3296
3570
  reactNative.Pressable,
3297
3571
  {
@@ -3315,12 +3589,13 @@ function isImageContentType(ct) {
3315
3589
  if (!ct) return false;
3316
3590
  return ct.startsWith("image/");
3317
3591
  }
3318
- function formatTime2(iso) {
3592
+ function formatTime2(iso, format2) {
3319
3593
  try {
3320
3594
  const d = new Date(iso);
3595
+ if (typeof format2 === "function") return format2(d);
3321
3596
  const now = /* @__PURE__ */ new Date();
3322
3597
  const sameDay2 = isSameDay(d, now);
3323
- const time = d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
3598
+ const time = formatClock(d, format2);
3324
3599
  if (sameDay2) return time;
3325
3600
  const yesterday = new Date(now);
3326
3601
  yesterday.setDate(now.getDate() - 1);
@@ -3360,6 +3635,9 @@ var styles17 = reactNative.StyleSheet.create({
3360
3635
  paddingHorizontal: 12,
3361
3636
  paddingVertical: 7
3362
3637
  },
3638
+ textBlockDense: {
3639
+ paddingVertical: 4
3640
+ },
3363
3641
  // A hair less air when media / files / a quote already sit above.
3364
3642
  textBlockAfter: {
3365
3643
  paddingTop: 6
@@ -3391,6 +3669,10 @@ var styles17 = reactNative.StyleSheet.create({
3391
3669
  // sat visibly low beside a one-line message.
3392
3670
  bottom: 11
3393
3671
  },
3672
+ // Same centring for the tighter `density="compact"` text block.
3673
+ metaInlineDense: {
3674
+ bottom: 8
3675
+ },
3394
3676
  metaOverlay: {
3395
3677
  position: "absolute",
3396
3678
  right: 6,
@@ -3457,7 +3739,7 @@ function ReactionStrip({
3457
3739
  meId,
3458
3740
  initialReactions
3459
3741
  }) {
3460
- const theme = usePoolseTheme();
3742
+ const theme = useTheme();
3461
3743
  const { reactions, addReaction, removeReaction } = react$1.useReactions(messageId, {
3462
3744
  conversationId,
3463
3745
  currentUserId: meId,
@@ -3475,8 +3757,8 @@ function ReactionStrip({
3475
3757
  style: [
3476
3758
  styles18.chip,
3477
3759
  {
3478
- backgroundColor: meReacted ? theme.colors.brandSoft : theme.colors.surface2,
3479
- borderColor: meReacted ? theme.colors.brand : theme.colors.border,
3760
+ backgroundColor: meReacted ? theme.colors.accentSoft : theme.colors.surfaceAlt,
3761
+ borderColor: meReacted ? theme.colors.accent : theme.colors.border,
3480
3762
  borderWidth: meReacted ? 1.5 : 1,
3481
3763
  transform: meReacted ? [{ scale: 1.04 }] : void 0
3482
3764
  }
@@ -3489,7 +3771,7 @@ function ReactionStrip({
3489
3771
  style: [
3490
3772
  styles18.count,
3491
3773
  {
3492
- color: meReacted ? theme.colors.brand : theme.colors.ink2,
3774
+ color: meReacted ? theme.colors.accent : theme.colors.textMuted,
3493
3775
  fontWeight: meReacted ? "700" : "600"
3494
3776
  }
3495
3777
  ],
@@ -3508,7 +3790,7 @@ function ReactionPicker({
3508
3790
  onPick,
3509
3791
  emojis = DEFAULT_EMOJIS
3510
3792
  }) {
3511
- const theme = usePoolseTheme();
3793
+ const theme = useTheme();
3512
3794
  const insets = useSafeInsets();
3513
3795
  return /* @__PURE__ */ jsxRuntime.jsx(
3514
3796
  reactNative.Modal,
@@ -3549,64 +3831,436 @@ function ReactionPicker({
3549
3831
  }
3550
3832
  )
3551
3833
  }
3552
- )
3834
+ )
3835
+ }
3836
+ );
3837
+ }
3838
+ var styles18 = reactNative.StyleSheet.create({
3839
+ strip: {
3840
+ flexDirection: "row",
3841
+ flexWrap: "wrap",
3842
+ gap: 4,
3843
+ marginTop: 2
3844
+ },
3845
+ chip: {
3846
+ flexDirection: "row",
3847
+ alignItems: "center",
3848
+ paddingHorizontal: 9,
3849
+ paddingVertical: 4,
3850
+ borderRadius: 14,
3851
+ gap: 5,
3852
+ minHeight: 26,
3853
+ // Subtle elevation so chips lift off the surface
3854
+ shadowColor: "#000",
3855
+ shadowOffset: { width: 0, height: 1 },
3856
+ shadowOpacity: 0.06,
3857
+ shadowRadius: 2,
3858
+ elevation: 1
3859
+ },
3860
+ emoji: {
3861
+ fontSize: 15,
3862
+ lineHeight: 18
3863
+ },
3864
+ count: {
3865
+ fontSize: 12,
3866
+ fontVariant: ["tabular-nums"]
3867
+ },
3868
+ backdrop: {
3869
+ flex: 1,
3870
+ backgroundColor: "rgba(0,0,0,0.4)",
3871
+ justifyContent: "center",
3872
+ alignItems: "center",
3873
+ paddingHorizontal: 24
3874
+ },
3875
+ sheet: {
3876
+ flexDirection: "row",
3877
+ paddingHorizontal: 12,
3878
+ paddingVertical: 12,
3879
+ gap: 4,
3880
+ alignItems: "center"
3881
+ },
3882
+ emojiBtn: {
3883
+ paddingHorizontal: 8,
3884
+ paddingVertical: 6,
3885
+ borderRadius: 999,
3886
+ alignItems: "center",
3887
+ justifyContent: "center"
3888
+ },
3889
+ bigEmoji: {
3890
+ fontSize: 32,
3891
+ lineHeight: 38
3892
+ }
3893
+ });
3894
+ var GUTTER = 40;
3895
+ function FlatMessageRow({
3896
+ msg,
3897
+ meId,
3898
+ layout,
3899
+ reactions = true,
3900
+ attachments = true,
3901
+ actions = true,
3902
+ threads = true,
3903
+ quotations = true,
3904
+ markdown = true,
3905
+ readState,
3906
+ isEditing = false,
3907
+ onStartEdit,
3908
+ onDelete,
3909
+ onOpenThread,
3910
+ onQuote,
3911
+ labelFor,
3912
+ onQuotedClick,
3913
+ groupPosition = "standalone",
3914
+ maxBodyLength = 0,
3915
+ showAvatar = layout === "list",
3916
+ avatarFor,
3917
+ onSenderPress,
3918
+ onAvatarPress,
3919
+ density = "comfortable",
3920
+ timeFormat,
3921
+ slots,
3922
+ mentionsMe = false
3923
+ }) {
3924
+ const theme = useTheme();
3925
+ const { width: screenWidth } = reactNative.useWindowDimensions();
3926
+ const compact = layout === "compact";
3927
+ const dense = density === "compact";
3928
+ const isSelf = meId !== null && msg.sender_id === meId;
3929
+ const [actionsOpen, setActionsOpen] = react.useState(false);
3930
+ const [expanded, setExpanded] = react.useState(false);
3931
+ const reactionsApi = react$1.useReactions(msg.id, {
3932
+ conversationId: msg.conversation_id,
3933
+ currentUserId: meId,
3934
+ ...msg.reactions ? { initialReactions: msg.reactions } : {}
3935
+ });
3936
+ const resolved = react$1.useUser(msg.sender_external_id);
3937
+ const ext = msg.sender_external_id;
3938
+ const senderName = ext ? labelFor?.(ext) ?? resolved.profile?.displayName ?? ext : msg.sender_id ? `User ${msg.sender_id.slice(0, 6)}` : "Unknown";
3939
+ const avatarUrl = ext ? avatarFor?.(ext) ?? resolved.profile?.avatarUrl ?? null : null;
3940
+ const sender = {
3941
+ userId: msg.sender_id,
3942
+ externalId: ext,
3943
+ displayName: senderName,
3944
+ avatarUrl
3945
+ };
3946
+ const isRunStart = compact || groupPosition === "first" || groupPosition === "standalone";
3947
+ const ctx = { message: msg, isSelf, sender, layout, isRunStart };
3948
+ const deleted = !!msg.deleted_at;
3949
+ const time = formatMessageTime(msg.inserted_at, timeFormat);
3950
+ const openActions = () => {
3951
+ if (actions && !deleted) setActionsOpen(true);
3952
+ };
3953
+ const text = { fontFamily: theme.fonts.body, color: theme.colors.text };
3954
+ const avatarEl = showAvatar ? /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: senderName, seed: ext, size: compact ? "xs" : "md" }) : null;
3955
+ const avatar = avatarEl && onAvatarPress && !isSelf ? /* @__PURE__ */ jsxRuntime.jsx(
3956
+ reactNative.Pressable,
3957
+ {
3958
+ onPress: () => onAvatarPress(sender),
3959
+ accessibilityRole: "button",
3960
+ accessibilityLabel: senderName,
3961
+ hitSlop: 6,
3962
+ children: avatarEl
3963
+ }
3964
+ ) : avatarEl;
3965
+ const name = /* @__PURE__ */ jsxRuntime.jsx(
3966
+ reactNative.Text,
3967
+ {
3968
+ style: [
3969
+ styles19.name,
3970
+ text,
3971
+ compact ? { color: userColor(ext ?? msg.sender_id ?? msg.id) } : null,
3972
+ compact ? styles19.nameCompact : null
3973
+ ],
3974
+ numberOfLines: 1,
3975
+ ...onSenderPress && !isSelf ? {
3976
+ onPress: () => onSenderPress(sender),
3977
+ accessibilityRole: "button",
3978
+ suppressHighlighting: true
3979
+ } : {},
3980
+ children: senderName
3981
+ }
3982
+ );
3983
+ const timeText = (dim) => /* @__PURE__ */ jsxRuntime.jsx(
3984
+ reactNative.Text,
3985
+ {
3986
+ style: [
3987
+ styles19.time,
3988
+ { color: theme.colors.textSubtle, fontFamily: theme.fonts.body },
3989
+ dim ? styles19.timeDim : null
3990
+ ],
3991
+ children: time
3992
+ }
3993
+ );
3994
+ const header = compact ? name : isRunStart ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.header, children: [
3995
+ name,
3996
+ timeText(false)
3997
+ ] }) : null;
3998
+ const images = attachments && !deleted ? (msg.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
3999
+ const files = attachments && !deleted ? (msg.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
4000
+ const mediaWidth = Math.min(screenWidth - GUTTER - 48, 320);
4001
+ const attachmentsEl = images.length > 0 || files.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.attachments, children: [
4002
+ images.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4003
+ ImageMosaic,
4004
+ {
4005
+ images,
4006
+ maxWidth: mediaWidth,
4007
+ radius: theme.radii.md,
4008
+ onLongPress: openActions
4009
+ }
4010
+ ) : null,
4011
+ files.map((att) => /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreview, { attachment: att, maxWidth: mediaWidth }, att.id))
4012
+ ] }) : null;
4013
+ const raw = msg.body ?? "";
4014
+ const trimmable = maxBodyLength > 0 && raw.length > maxBodyLength;
4015
+ const shown = trimmable && !expanded ? raw.slice(0, maxBodyLength) + "\u2026" : raw;
4016
+ const jumbo = raw && images.length === 0 && files.length === 0 && !msg.quoted_message_id ? emojiOnlyCount(raw) : 0;
4017
+ const bodyText = {
4018
+ ...text,
4019
+ fontSize: dense ? theme.fonts.sizeMd - 1 : theme.fonts.sizeMd,
4020
+ lineHeight: dense ? theme.fonts.lineHeight - 3 : theme.fonts.lineHeight
4021
+ };
4022
+ const edited = !!msg.edited_at && !deleted;
4023
+ const meta = edited || isSelf && readState ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.meta, children: [
4024
+ edited ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles19.edited, { color: theme.colors.textSubtle }], children: "(edited)" }) : null,
4025
+ isSelf && readState ? /* @__PURE__ */ jsxRuntime.jsx(
4026
+ PoolseIcon,
4027
+ {
4028
+ name: readState === "read" ? "check-double" : "check",
4029
+ size: 13,
4030
+ color: readState === "read" ? theme.colors.accent : theme.colors.textSubtle
4031
+ }
4032
+ ) : null
4033
+ ] }) : null;
4034
+ const body = deleted ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [bodyText, styles19.deleted, { color: theme.colors.textMuted }], children: "Message deleted" }) : raw ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
4035
+ jumbo > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { fontSize: emojiFontSize(jumbo), lineHeight: emojiFontSize(jumbo) + 8 }, children: raw }) : markdown && hasMarkdown(shown) ? renderMarkdown(shown, {
4036
+ textColor: bodyText.color,
4037
+ linkColor: theme.colors.link,
4038
+ fontFamily: theme.fonts.body,
4039
+ fontSize: bodyText.fontSize,
4040
+ lineHeight: bodyText.lineHeight,
4041
+ onLinkPress: (url) => {
4042
+ void reactNative.Linking.openURL(url).catch(() => void 0);
4043
+ return false;
4044
+ }
4045
+ }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: bodyText, children: shown }),
4046
+ trimmable ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles19.readMore, { color: theme.colors.link }], children: expanded ? "Show less" : "Read more" }) }) : null,
4047
+ meta
4048
+ ] }) : meta;
4049
+ const replyCount = msg.reply_count ?? 0;
4050
+ const threadEl = threads && !deleted && !msg.thread_root_id && replyCount > 0 && onOpenThread ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Pressable, { onPress: onOpenThread, style: styles19.thread, accessibilityRole: "button", children: [
4051
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 13, color: theme.colors.link }),
4052
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles19.threadText, { color: theme.colors.link }], children: [
4053
+ replyCount,
4054
+ " ",
4055
+ replyCount === 1 ? "reply" : "replies"
4056
+ ] })
4057
+ ] }) : null;
4058
+ const reactionsEl = reactions && !deleted ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles19.reactions, children: /* @__PURE__ */ jsxRuntime.jsx(
4059
+ ReactionStrip,
4060
+ {
4061
+ messageId: msg.id,
4062
+ conversationId: msg.conversation_id,
4063
+ meId,
4064
+ ...msg.reactions ? { initialReactions: msg.reactions } : {}
4065
+ }
4066
+ ) }) : null;
4067
+ const quote = msg.quoted_message ? /* @__PURE__ */ jsxRuntime.jsx(
4068
+ QuotedCard,
4069
+ {
4070
+ quoted: msg.quoted_message,
4071
+ isSelf: false,
4072
+ ...labelFor ? { labelFor } : {},
4073
+ ...onQuotedClick ? { onPress: () => onQuotedClick(msg.quoted_message.id) } : {}
4074
+ }
4075
+ ) : null;
4076
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.content, children: [
4077
+ !compact ? renderSlot(slots?.header, ctx, header) : null,
4078
+ quote,
4079
+ renderSlot(slots?.attachments, ctx, attachmentsEl),
4080
+ renderSlot(slots?.body, ctx, body),
4081
+ renderSlot(slots?.reactions, ctx, reactionsEl),
4082
+ renderSlot(slots?.thread, ctx, threadEl)
4083
+ ] });
4084
+ const close = () => setActionsOpen(false);
4085
+ const sheet = actions && actionsOpen ? /* @__PURE__ */ jsxRuntime.jsx(
4086
+ MessageActions,
4087
+ {
4088
+ visible: true,
4089
+ onClose: close,
4090
+ isSelf,
4091
+ ...reactions ? { onPickReaction: (emoji) => void reactionsApi.addReaction(emoji) } : {},
4092
+ ...msg.body && !deleted ? {
4093
+ onCopy: () => {
4094
+ close();
4095
+ void Clipboard__namespace.setStringAsync(msg.body ?? "");
4096
+ }
4097
+ } : {},
4098
+ ...onStartEdit ? {
4099
+ onEdit: () => {
4100
+ close();
4101
+ onStartEdit();
4102
+ }
4103
+ } : {},
4104
+ ...onDelete ? {
4105
+ onDelete: () => {
4106
+ close();
4107
+ onDelete();
4108
+ }
4109
+ } : {},
4110
+ ...threads && onOpenThread ? {
4111
+ onReplyInThread: () => {
4112
+ close();
4113
+ onOpenThread();
4114
+ }
4115
+ } : {},
4116
+ ...quotations && onQuote ? {
4117
+ onQuote: () => {
4118
+ close();
4119
+ onQuote();
4120
+ }
4121
+ } : {}
4122
+ }
4123
+ ) : null;
4124
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4125
+ reactNative.View,
4126
+ {
4127
+ style: [
4128
+ styles19.row,
4129
+ compact ? styles19.rowCompact : null,
4130
+ dense ? styles19.rowDense : null,
4131
+ !compact && isRunStart ? dense ? styles19.runStartDense : styles19.runStart : null,
4132
+ mentionsMe ? { backgroundColor: theme.colors.mention, borderLeftColor: theme.colors.accent } : null,
4133
+ isEditing ? styles19.rowEditing : null
4134
+ ],
4135
+ children: [
4136
+ /* @__PURE__ */ jsxRuntime.jsx(
4137
+ reactNative.Pressable,
4138
+ {
4139
+ onLongPress: openActions,
4140
+ style: [styles19.line, compact ? styles19.lineCompact : null],
4141
+ accessibilityRole: "button",
4142
+ accessibilityLabel: "Message actions",
4143
+ children: compact ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4144
+ timeText(false),
4145
+ avatar ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles19.avatarCompact, children: avatar }) : null,
4146
+ renderSlot(slots?.header, ctx, header),
4147
+ content
4148
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4149
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles19.gutter, children: isRunStart ? avatar : timeText(true) }),
4150
+ content
4151
+ ] })
4152
+ }
4153
+ ),
4154
+ renderSlot(slots?.actions, ctx, sheet)
4155
+ ]
3553
4156
  }
3554
4157
  );
3555
4158
  }
3556
- var styles18 = reactNative.StyleSheet.create({
3557
- strip: {
3558
- flexDirection: "row",
3559
- flexWrap: "wrap",
3560
- gap: 4,
3561
- marginTop: 2
4159
+ var styles19 = reactNative.StyleSheet.create({
4160
+ row: {
4161
+ // 3px left border reserved for the mention accent bar.
4162
+ borderLeftWidth: 3,
4163
+ borderLeftColor: "transparent",
4164
+ paddingLeft: 9,
4165
+ paddingRight: 12,
4166
+ paddingVertical: 2
3562
4167
  },
3563
- chip: {
4168
+ rowCompact: {
4169
+ paddingVertical: 1
4170
+ },
4171
+ rowDense: {
4172
+ paddingVertical: 0
4173
+ },
4174
+ runStart: {
4175
+ marginTop: 8,
4176
+ paddingTop: 4
4177
+ },
4178
+ runStartDense: {
4179
+ marginTop: 4,
4180
+ paddingTop: 2
4181
+ },
4182
+ rowEditing: {
4183
+ // Above ConversationView's edit backdrop, like the bubble row.
4184
+ zIndex: 10,
4185
+ elevation: 10
4186
+ },
4187
+ line: {
3564
4188
  flexDirection: "row",
3565
- alignItems: "center",
3566
- paddingHorizontal: 9,
3567
- paddingVertical: 4,
3568
- borderRadius: 14,
3569
- gap: 5,
3570
- minHeight: 26,
3571
- // Subtle elevation so chips lift off the surface
3572
- shadowColor: "#000",
3573
- shadowOffset: { width: 0, height: 1 },
3574
- shadowOpacity: 0.06,
3575
- shadowRadius: 2,
3576
- elevation: 1
4189
+ alignItems: "flex-start",
4190
+ gap: 8
3577
4191
  },
3578
- emoji: {
3579
- fontSize: 15,
3580
- lineHeight: 18
4192
+ lineCompact: {
4193
+ gap: 6
3581
4194
  },
3582
- count: {
3583
- fontSize: 12,
3584
- fontVariant: ["tabular-nums"]
4195
+ gutter: {
4196
+ width: GUTTER,
4197
+ alignItems: "center"
3585
4198
  },
3586
- backdrop: {
4199
+ avatarCompact: {
4200
+ marginTop: 1
4201
+ },
4202
+ content: {
3587
4203
  flex: 1,
3588
- backgroundColor: "rgba(0,0,0,0.4)",
3589
- justifyContent: "center",
3590
- alignItems: "center",
3591
- paddingHorizontal: 24
4204
+ minWidth: 0
3592
4205
  },
3593
- sheet: {
4206
+ header: {
3594
4207
  flexDirection: "row",
3595
- paddingHorizontal: 12,
3596
- paddingVertical: 12,
4208
+ alignItems: "baseline",
4209
+ gap: 8
4210
+ },
4211
+ name: {
4212
+ fontSize: 14,
4213
+ fontWeight: "700",
4214
+ flexShrink: 1
4215
+ },
4216
+ nameCompact: {
4217
+ maxWidth: "35%",
4218
+ flexShrink: 0
4219
+ },
4220
+ time: {
4221
+ fontSize: 11,
4222
+ fontVariant: ["tabular-nums"],
4223
+ lineHeight: 20
4224
+ },
4225
+ timeDim: {
4226
+ fontSize: 10,
4227
+ opacity: 0.7
4228
+ },
4229
+ attachments: {
4230
+ marginVertical: 4,
4231
+ gap: 4
4232
+ },
4233
+ deleted: {
4234
+ fontStyle: "italic"
4235
+ },
4236
+ readMore: {
4237
+ fontSize: 12,
4238
+ fontWeight: "600",
4239
+ marginTop: 2
4240
+ },
4241
+ meta: {
4242
+ flexDirection: "row",
4243
+ alignItems: "center",
3597
4244
  gap: 4,
3598
- alignItems: "center"
4245
+ marginTop: 1
3599
4246
  },
3600
- emojiBtn: {
3601
- paddingHorizontal: 8,
3602
- paddingVertical: 6,
3603
- borderRadius: 999,
4247
+ edited: {
4248
+ fontSize: 11
4249
+ },
4250
+ reactions: {
4251
+ marginTop: 4,
4252
+ alignSelf: "flex-start"
4253
+ },
4254
+ thread: {
4255
+ flexDirection: "row",
3604
4256
  alignItems: "center",
3605
- justifyContent: "center"
4257
+ gap: 4,
4258
+ marginTop: 4,
4259
+ alignSelf: "flex-start"
3606
4260
  },
3607
- bigEmoji: {
3608
- fontSize: 32,
3609
- lineHeight: 38
4261
+ threadText: {
4262
+ fontSize: 12.5,
4263
+ fontWeight: "600"
3610
4264
  }
3611
4265
  });
3612
4266
  var SWIPE_REPLY_THRESHOLD = 50;
@@ -3622,6 +4276,9 @@ function MessageRow(props) {
3622
4276
  }
3623
4277
  ) : null;
3624
4278
  }
4279
+ if (props.layout === "list" || props.layout === "compact") {
4280
+ return /* @__PURE__ */ jsxRuntime.jsx(FlatMessageRow, { ...props, layout: props.layout });
4281
+ }
3625
4282
  return /* @__PURE__ */ jsxRuntime.jsx(BubbleMessageRow, { ...props });
3626
4283
  }
3627
4284
  function BubbleMessageRow({
@@ -3645,9 +4302,14 @@ function BubbleMessageRow({
3645
4302
  maxBodyLength = 0,
3646
4303
  showSenderName = false,
3647
4304
  showAvatar = false,
3648
- avatarFor
4305
+ avatarFor,
4306
+ onSenderPress,
4307
+ onAvatarPress,
4308
+ density = "comfortable",
4309
+ timeFormat,
4310
+ slots
3649
4311
  }) {
3650
- const theme = usePoolseTheme();
4312
+ const theme = useTheme();
3651
4313
  const isSelf = meId !== null && msg.sender_id === meId;
3652
4314
  const [actionsOpen, setActionsOpen] = react.useState(false);
3653
4315
  const reactionsApi = react$1.useReactions(msg.id, {
@@ -3728,45 +4390,70 @@ function BubbleMessageRow({
3728
4390
  });
3729
4391
  const showAvatarSlot = showAvatar && !isSelf;
3730
4392
  const showAvatarRender = showAvatarSlot && (groupPosition === "last" || groupPosition === "standalone");
3731
- const rowSender = react$1.useUser(showAvatarSlot ? msg.sender_external_id : null);
4393
+ const wantsSender = showAvatarSlot || !isSelf && onSenderPress !== void 0;
4394
+ const rowSender = react$1.useUser(wantsSender ? msg.sender_external_id : null);
3732
4395
  const avatarUrl = msg.sender_external_id ? avatarFor?.(msg.sender_external_id) ?? rowSender.profile?.avatarUrl ?? null : null;
3733
4396
  const senderLabel = msg.sender_external_id ? labelFor?.(msg.sender_external_id) ?? rowSender.profile?.displayName ?? msg.sender_external_id : null;
4397
+ const sender = {
4398
+ userId: msg.sender_id,
4399
+ externalId: msg.sender_external_id,
4400
+ displayName: senderLabel ?? "Unknown",
4401
+ avatarUrl
4402
+ };
4403
+ const slotContext = {
4404
+ message: msg,
4405
+ isSelf,
4406
+ sender,
4407
+ layout: "bubbles",
4408
+ isRunStart: groupPosition === "first" || groupPosition === "standalone"
4409
+ };
4410
+ const avatar = /* @__PURE__ */ jsxRuntime.jsx(
4411
+ Avatar,
4412
+ {
4413
+ src: avatarUrl ?? null,
4414
+ name: senderLabel,
4415
+ seed: msg.sender_external_id ?? null,
4416
+ size: "sm"
4417
+ }
4418
+ );
3734
4419
  return /* @__PURE__ */ jsxRuntime.jsxs(
3735
4420
  reactNative.View,
3736
4421
  {
3737
4422
  style: [
3738
- styles19.row,
4423
+ styles20.row,
3739
4424
  { alignSelf: isSelf ? "flex-end" : "flex-start" },
4425
+ density === "compact" ? styles20.rowDense : null,
3740
4426
  // Lift this row above the dim backdrop the parent renders
3741
4427
  // during edit mode. zIndex covers iOS / web; elevation does
3742
4428
  // the equivalent on Android.
3743
- isEditing ? styles19.rowEditing : null
4429
+ isEditing ? styles20.rowEditing : null
3744
4430
  ],
3745
4431
  children: [
3746
- showAvatarSlot ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles19.avatarSlot, children: showAvatarRender ? /* @__PURE__ */ jsxRuntime.jsx(
3747
- Avatar,
4432
+ showAvatarSlot ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles20.avatarSlot, children: !showAvatarRender ? null : onAvatarPress ? /* @__PURE__ */ jsxRuntime.jsx(
4433
+ reactNative.Pressable,
3748
4434
  {
3749
- src: avatarUrl ?? null,
3750
- name: senderLabel,
3751
- seed: msg.sender_external_id ?? null,
3752
- size: "sm"
4435
+ onPress: () => onAvatarPress(sender),
4436
+ accessibilityRole: "button",
4437
+ accessibilityLabel: sender.displayName,
4438
+ hitSlop: 6,
4439
+ children: avatar
3753
4440
  }
3754
- ) : null }) : null,
3755
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.bubbleCol, children: [
4441
+ ) : avatar }) : null,
4442
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles20.bubbleCol, children: [
3756
4443
  swipeEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
3757
4444
  reactNative.Animated.View,
3758
4445
  {
3759
4446
  pointerEvents: "none",
3760
4447
  style: [
3761
- styles19.replyHint,
3762
- isSelf ? styles19.replyHintRight : styles19.replyHintLeft,
4448
+ styles20.replyHint,
4449
+ isSelf ? styles20.replyHintRight : styles20.replyHintLeft,
3763
4450
  {
3764
4451
  opacity: replyIconOpacity,
3765
4452
  transform: [{ scale: replyIconScale }],
3766
- backgroundColor: theme.colors.surface2
4453
+ backgroundColor: theme.colors.surfaceAlt
3767
4454
  }
3768
4455
  ],
3769
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "reply", size: 16, color: theme.colors.brand })
4456
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "reply", size: 16, color: theme.colors.accent })
3770
4457
  }
3771
4458
  ) : null,
3772
4459
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3794,8 +4481,12 @@ function BubbleMessageRow({
3794
4481
  groupPosition,
3795
4482
  maxBodyLength,
3796
4483
  showSenderName,
4484
+ ...onSenderPress ? { onSenderPress: () => onSenderPress(sender) } : {},
3797
4485
  showAttachments: attachments,
3798
4486
  markdown,
4487
+ density,
4488
+ ...timeFormat ? { timeFormat } : {},
4489
+ ...slots ? { slots, slotContext } : {},
3799
4490
  onLongPress: () => {
3800
4491
  if (actions) setActionsOpen(true);
3801
4492
  }
@@ -3805,72 +4496,84 @@ function BubbleMessageRow({
3805
4496
  )
3806
4497
  }
3807
4498
  ),
3808
- threads && (msg.reply_count ?? 0) > 0 && onOpenThread ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onOpenThread, style: styles19.threadPill, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles19.threadPillText, { color: theme.colors.brand }], children: [
3809
- "\u{1F4AC} ",
3810
- msg.reply_count,
3811
- " ",
3812
- msg.reply_count === 1 ? "reply" : "replies"
3813
- ] }) }) : null,
3814
- reactions ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles19.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsxRuntime.jsx(
3815
- ReactionStrip,
4499
+ renderSlot(
4500
+ slots?.thread,
4501
+ slotContext,
4502
+ threads && (msg.reply_count ?? 0) > 0 && onOpenThread ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: onOpenThread, style: styles20.threadPill, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: [styles20.threadPillText, { color: theme.colors.accent }], children: [
4503
+ "\u{1F4AC} ",
4504
+ msg.reply_count,
4505
+ " ",
4506
+ msg.reply_count === 1 ? "reply" : "replies"
4507
+ ] }) }) : null
4508
+ ),
4509
+ renderSlot(
4510
+ slots?.reactions,
4511
+ slotContext,
4512
+ reactions ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles20.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsxRuntime.jsx(
4513
+ ReactionStrip,
4514
+ {
4515
+ messageId: msg.id,
4516
+ conversationId: msg.conversation_id,
4517
+ meId,
4518
+ ...msg.reactions ? { initialReactions: msg.reactions } : {}
4519
+ }
4520
+ ) }) : null
4521
+ )
4522
+ ] }),
4523
+ renderSlot(
4524
+ slots?.actions,
4525
+ slotContext,
4526
+ actions && actionsOpen ? /* @__PURE__ */ jsxRuntime.jsx(
4527
+ MessageActions,
3816
4528
  {
3817
- messageId: msg.id,
3818
- conversationId: msg.conversation_id,
3819
- meId,
3820
- ...msg.reactions ? { initialReactions: msg.reactions } : {}
4529
+ visible: actionsOpen,
4530
+ onClose: () => setActionsOpen(false),
4531
+ isSelf,
4532
+ ...reactions ? {
4533
+ // Inline quick-react row at the top of the sheet —
4534
+ // one tap = react + close, no second modal needed.
4535
+ onPickReaction: (emoji) => {
4536
+ void reactionsApi.addReaction(emoji);
4537
+ }
4538
+ } : {},
4539
+ ...msg.body && !msg.deleted_at ? {
4540
+ onCopy: () => {
4541
+ setActionsOpen(false);
4542
+ void Clipboard__namespace.setStringAsync(msg.body ?? "");
4543
+ }
4544
+ } : {},
4545
+ ...onStartEdit ? {
4546
+ onEdit: () => {
4547
+ setActionsOpen(false);
4548
+ onStartEdit();
4549
+ }
4550
+ } : {},
4551
+ ...onDelete ? {
4552
+ onDelete: () => {
4553
+ setActionsOpen(false);
4554
+ onDelete();
4555
+ }
4556
+ } : {},
4557
+ ...onOpenThread ? {
4558
+ onReplyInThread: () => {
4559
+ setActionsOpen(false);
4560
+ onOpenThread();
4561
+ }
4562
+ } : {},
4563
+ ...quotations && onQuote ? {
4564
+ onQuote: () => {
4565
+ setActionsOpen(false);
4566
+ onQuote();
4567
+ }
4568
+ } : {}
3821
4569
  }
3822
- ) }) : null
3823
- ] }),
3824
- actions && actionsOpen ? /* @__PURE__ */ jsxRuntime.jsx(
3825
- MessageActions,
3826
- {
3827
- visible: actionsOpen,
3828
- onClose: () => setActionsOpen(false),
3829
- isSelf,
3830
- ...reactions ? {
3831
- // Inline quick-react row at the top of the sheet —
3832
- // one tap = react + close, no second modal needed.
3833
- onPickReaction: (emoji) => {
3834
- void reactionsApi.addReaction(emoji);
3835
- }
3836
- } : {},
3837
- ...msg.body && !msg.deleted_at ? {
3838
- onCopy: () => {
3839
- setActionsOpen(false);
3840
- void Clipboard__namespace.setStringAsync(msg.body ?? "");
3841
- }
3842
- } : {},
3843
- ...onStartEdit ? {
3844
- onEdit: () => {
3845
- setActionsOpen(false);
3846
- onStartEdit();
3847
- }
3848
- } : {},
3849
- ...onDelete ? {
3850
- onDelete: () => {
3851
- setActionsOpen(false);
3852
- onDelete();
3853
- }
3854
- } : {},
3855
- ...onOpenThread ? {
3856
- onReplyInThread: () => {
3857
- setActionsOpen(false);
3858
- onOpenThread();
3859
- }
3860
- } : {},
3861
- ...quotations && onQuote ? {
3862
- onQuote: () => {
3863
- setActionsOpen(false);
3864
- onQuote();
3865
- }
3866
- } : {}
3867
- }
3868
- ) : null
4570
+ ) : null
4571
+ )
3869
4572
  ]
3870
4573
  }
3871
4574
  );
3872
4575
  }
3873
- var styles19 = reactNative.StyleSheet.create({
4576
+ var styles20 = reactNative.StyleSheet.create({
3874
4577
  row: {
3875
4578
  flexDirection: "row",
3876
4579
  alignItems: "flex-end",
@@ -3884,6 +4587,9 @@ var styles19 = reactNative.StyleSheet.create({
3884
4587
  paddingHorizontal: 10,
3885
4588
  maxWidth: "95%"
3886
4589
  },
4590
+ rowDense: {
4591
+ marginVertical: 0
4592
+ },
3887
4593
  rowEditing: {
3888
4594
  // Above ConversationView's editBackdrop (zIndex 5). Elevation
3889
4595
  // does the equivalent stacking on Android.
@@ -3936,7 +4642,9 @@ function ThreadView({
3936
4642
  conversationId,
3937
4643
  rootMessage,
3938
4644
  labelFor,
3939
- avatarFor
4645
+ avatarFor,
4646
+ layout,
4647
+ timeFormat
3940
4648
  }) {
3941
4649
  return /* @__PURE__ */ jsxRuntime.jsx(
3942
4650
  reactNative.Modal,
@@ -3953,7 +4661,9 @@ function ThreadView({
3953
4661
  conversationId,
3954
4662
  rootMessage,
3955
4663
  ...labelFor ? { labelFor } : {},
3956
- ...avatarFor ? { avatarFor } : {}
4664
+ ...avatarFor ? { avatarFor } : {},
4665
+ ...layout ? { layout } : {},
4666
+ ...timeFormat ? { timeFormat } : {}
3957
4667
  }
3958
4668
  ) })
3959
4669
  }
@@ -3964,9 +4674,11 @@ function ThreadSheet({
3964
4674
  conversationId,
3965
4675
  rootMessage,
3966
4676
  labelFor,
3967
- avatarFor
4677
+ avatarFor,
4678
+ layout,
4679
+ timeFormat
3968
4680
  }) {
3969
- const theme = usePoolseTheme();
4681
+ const theme = useTheme();
3970
4682
  const { me } = react$1.useMe();
3971
4683
  const meId = me?.id ?? null;
3972
4684
  const {
@@ -4009,11 +4721,13 @@ function ThreadSheet({
4009
4721
  void deleteReply(msg.id);
4010
4722
  },
4011
4723
  ...labelFor ? { labelFor } : {},
4012
- ...avatarFor ? { avatarFor } : {}
4724
+ ...avatarFor ? { avatarFor } : {},
4725
+ ...layout ? { layout } : {},
4726
+ ...timeFormat ? { timeFormat } : {}
4013
4727
  }
4014
4728
  );
4015
4729
  },
4016
- [meId, editingId, deleteReply, labelFor, avatarFor]
4730
+ [meId, editingId, deleteReply, labelFor, avatarFor, layout, timeFormat]
4017
4731
  );
4018
4732
  const editingMessage = react.useMemo(
4019
4733
  () => editingId ? replies.find((m) => m.id === editingId) ?? null : null,
@@ -4031,26 +4745,28 @@ function ThreadSheet({
4031
4745
  threads: false,
4032
4746
  quotations: false,
4033
4747
  ...labelFor ? { labelFor } : {},
4034
- ...avatarFor ? { avatarFor } : {}
4748
+ ...avatarFor ? { avatarFor } : {},
4749
+ ...layout ? { layout } : {},
4750
+ ...timeFormat ? { timeFormat } : {}
4035
4751
  }
4036
4752
  ),
4037
- [rootMessage, meId, labelFor, avatarFor]
4753
+ [rootMessage, meId, labelFor, avatarFor, layout, timeFormat]
4038
4754
  );
4039
4755
  return /* @__PURE__ */ jsxRuntime.jsxs(
4040
4756
  reactNative.View,
4041
4757
  {
4042
- style: styles20.modalRoot,
4758
+ style: styles21.modalRoot,
4043
4759
  onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
4044
4760
  children: [
4045
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles20.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
4761
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles21.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
4046
4762
  /* @__PURE__ */ jsxRuntime.jsxs(
4047
4763
  reactNative.Animated.View,
4048
4764
  {
4049
4765
  style: [
4050
- styles20.sheet,
4766
+ styles21.sheet,
4051
4767
  {
4052
4768
  height: sheetHeight,
4053
- backgroundColor: theme.colors.paper,
4769
+ backgroundColor: theme.colors.background,
4054
4770
  borderTopLeftRadius: theme.radii.xl,
4055
4771
  borderTopRightRadius: theme.radii.xl,
4056
4772
  paddingLeft: insets.left,
@@ -4061,25 +4777,22 @@ function ThreadSheet({
4061
4777
  ],
4062
4778
  children: [
4063
4779
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ...panHandlers, children: [
4064
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles20.dragHandle, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles20.dragPill, { backgroundColor: theme.colors.ink3 }] }) }),
4065
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles20.header, { borderBottomColor: theme.colors.border }], children: [
4780
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles21.dragHandle, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles21.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
4781
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles21.header, { borderBottomColor: theme.colors.border }], children: [
4066
4782
  /* @__PURE__ */ jsxRuntime.jsx(
4067
4783
  reactNative.Pressable,
4068
4784
  {
4069
4785
  onPress: onClose,
4070
4786
  hitSlop: 16,
4071
- style: [styles20.closeBtn, { backgroundColor: theme.colors.surface2 }],
4787
+ style: [styles21.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
4072
4788
  accessibilityLabel: "Close thread",
4073
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.ink })
4789
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
4074
4790
  }
4075
4791
  ),
4076
4792
  /* @__PURE__ */ jsxRuntime.jsx(
4077
4793
  reactNative.Text,
4078
4794
  {
4079
- style: [
4080
- styles20.title,
4081
- { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
4082
- ],
4795
+ style: [styles21.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
4083
4796
  children: "Thread"
4084
4797
  }
4085
4798
  )
@@ -4088,12 +4801,12 @@ function ThreadSheet({
4088
4801
  /* @__PURE__ */ jsxRuntime.jsxs(
4089
4802
  reactNative.KeyboardAvoidingView,
4090
4803
  {
4091
- style: styles20.kavBody,
4804
+ style: styles21.kavBody,
4092
4805
  behavior: "padding",
4093
4806
  keyboardVerticalOffset: gutter,
4094
4807
  children: [
4095
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles20.rootPreview, { backgroundColor: theme.colors.surface2 }], children: rootRow }),
4096
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles20.listWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
4808
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles21.rootPreview, { backgroundColor: theme.colors.surfaceAlt }], children: rootRow }),
4809
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles21.listWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
4097
4810
  MessageList,
4098
4811
  {
4099
4812
  messages: replies,
@@ -4131,7 +4844,7 @@ function ThreadSheet({
4131
4844
  }
4132
4845
  );
4133
4846
  }
4134
- var styles20 = reactNative.StyleSheet.create({
4847
+ var styles21 = reactNative.StyleSheet.create({
4135
4848
  modalRoot: {
4136
4849
  flex: 1,
4137
4850
  justifyContent: "flex-end"
@@ -4186,9 +4899,9 @@ var styles20 = reactNative.StyleSheet.create({
4186
4899
  }
4187
4900
  });
4188
4901
  function UserName({ externalId, fallback, labelFor }) {
4189
- const theme = usePoolseTheme();
4902
+ const theme = useTheme();
4190
4903
  const name = useDisplayName(externalId, labelFor) ?? fallback ?? externalId ?? "";
4191
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.ink, fontFamily: theme.type.fontBody }, children: name });
4904
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.text, fontFamily: theme.fonts.body }, children: name });
4192
4905
  }
4193
4906
  function useDisplayName(externalId, labelFor) {
4194
4907
  const resolved = react$1.useUser(externalId ?? null);
@@ -4203,13 +4916,13 @@ function TypingIndicator({ typing, labelFor }) {
4203
4916
  const ids = Array.from(typing);
4204
4917
  const isTyping = ids.length > 0;
4205
4918
  if (!isTyping) return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { height: 0 } });
4206
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles21.row, children: [
4919
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles22.row, children: [
4207
4920
  /* @__PURE__ */ jsxRuntime.jsx(TypingDots, {}),
4208
4921
  /* @__PURE__ */ jsxRuntime.jsx(TypingLabel, { ids, ...labelFor ? { labelFor } : {} })
4209
4922
  ] });
4210
4923
  }
4211
4924
  function TypingDots() {
4212
- const theme = usePoolseTheme();
4925
+ const theme = useTheme();
4213
4926
  const a = react.useRef(new reactNative.Animated.Value(0)).current;
4214
4927
  const b = react.useRef(new reactNative.Animated.Value(0)).current;
4215
4928
  const c = react.useRef(new reactNative.Animated.Value(0)).current;
@@ -4239,7 +4952,7 @@ function TypingDots() {
4239
4952
  width: 6,
4240
4953
  height: 6,
4241
4954
  borderRadius: 3,
4242
- backgroundColor: theme.colors.ink3,
4955
+ backgroundColor: theme.colors.textSubtle,
4243
4956
  marginHorizontal: 2,
4244
4957
  transform: [
4245
4958
  {
@@ -4248,7 +4961,7 @@ function TypingDots() {
4248
4961
  ],
4249
4962
  opacity: val.interpolate({ inputRange: [0, 1], outputRange: [0.5, 1] })
4250
4963
  });
4251
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles21.dotsWrap, children: [
4964
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles22.dotsWrap, children: [
4252
4965
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: dot(a) }),
4253
4966
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: dot(b) }),
4254
4967
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: dot(c) })
@@ -4258,15 +4971,15 @@ function TypingLabel({
4258
4971
  ids,
4259
4972
  labelFor
4260
4973
  }) {
4261
- const theme = usePoolseTheme();
4974
+ const theme = useTheme();
4262
4975
  const id1 = ids[0] ?? null;
4263
4976
  const id2 = ids[1] ?? null;
4264
4977
  const name1 = useDisplayName(id1, labelFor);
4265
4978
  const name2 = useDisplayName(id2, labelFor);
4266
4979
  const text = ids.length === 1 ? `${name1} is typing` : ids.length === 2 ? `${name1} and ${name2} are typing` : `${ids.length} people are typing`;
4267
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles21.label, { color: theme.colors.ink2, fontFamily: theme.type.fontBody }], children: text });
4980
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles22.label, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }], children: text });
4268
4981
  }
4269
- var styles21 = reactNative.StyleSheet.create({
4982
+ var styles22 = reactNative.StyleSheet.create({
4270
4983
  row: {
4271
4984
  flexDirection: "row",
4272
4985
  alignItems: "center",
@@ -4283,7 +4996,7 @@ var styles21 = reactNative.StyleSheet.create({
4283
4996
  fontSize: 12
4284
4997
  }
4285
4998
  });
4286
- var GROUPING_WINDOW_MS = 5 * 60 * 1e3;
4999
+ var GROUP_WINDOW_MINUTES = 5;
4287
5000
  function ConversationView({
4288
5001
  conversationId,
4289
5002
  emptyState,
@@ -4306,12 +5019,28 @@ function ConversationView({
4306
5019
  avatars = "auto",
4307
5020
  onMarkedRead,
4308
5021
  onSent,
5022
+ focusMessageId = null,
5023
+ onFocusMessageNotFound,
5024
+ onSenderPress,
5025
+ onAvatarPress,
5026
+ composer = true,
5027
+ readOnly = false,
4309
5028
  keyboardOffset = 0,
4310
5029
  onCallBack,
4311
5030
  onJoinCall,
4312
- currentCallId = null
5031
+ currentCallId = null,
5032
+ layout = "bubbles",
5033
+ density = "comfortable",
5034
+ showAvatars: showAvatarsProp,
5035
+ timeFormat,
5036
+ groupWindowMinutes = GROUP_WINDOW_MINUTES,
5037
+ daySeparators = true,
5038
+ slots
4313
5039
  }) {
4314
- const theme = usePoolseTheme();
5040
+ const theme = useTheme();
5041
+ const showComposer = composer && !readOnly;
5042
+ const canQuote = quotations && showComposer;
5043
+ const canAttach = attachments && showComposer;
4315
5044
  const { me } = react$1.useMe();
4316
5045
  const meId = me?.id ?? null;
4317
5046
  const receiptsVisible = react$1.receiptsOf(me).visible;
@@ -4321,6 +5050,7 @@ function ConversationView({
4321
5050
  loading,
4322
5051
  hasMore,
4323
5052
  loadMore,
5053
+ loadUntil,
4324
5054
  send,
4325
5055
  edit,
4326
5056
  delete: deleteMsg,
@@ -4356,7 +5086,16 @@ function ConversationView({
4356
5086
  const { members } = react$1.useMembers(wantsMembers ? conversationId : "");
4357
5087
  const isGroupChat = members.length > 2;
4358
5088
  const showSenderLabels = senderLabels === "always" || senderLabels === "auto" && isGroupChat;
4359
- const showAvatars = avatars === "always" || avatars === "auto" && isGroupChat;
5089
+ const showAvatars = showAvatarsProp ?? (layout === "list" ? true : layout === "compact" ? false : avatars === "always" || avatars === "auto" && isGroupChat);
5090
+ const layoutProps = react.useMemo(
5091
+ () => ({
5092
+ layout,
5093
+ density,
5094
+ ...timeFormat ? { timeFormat } : {},
5095
+ ...slots ? { slots } : {}
5096
+ }),
5097
+ [layout, density, timeFormat, slots]
5098
+ );
4360
5099
  const [replyingTo, setReplyingTo] = react.useState(null);
4361
5100
  const [editingId, setEditingId] = react.useState(null);
4362
5101
  const [threadRoot, setThreadRoot] = react.useState(null);
@@ -4370,22 +5109,73 @@ function ConversationView({
4370
5109
  }, [messages]);
4371
5110
  const lastMarkedRef = react.useRef(null);
4372
5111
  react.useEffect(() => {
4373
- if (!readReceipts) return;
4374
- if (messages.length === 0) return;
4375
- const latest = messages[messages.length - 1];
4376
- if (!latest || !latest.id) return;
4377
- if (latest.id === lastMarkedRef.current) return;
4378
- if (typeof latest.sequence !== "number" || latest.sequence <= 0) return;
4379
- lastMarkedRef.current = latest.id;
4380
- void markReadUpTo(latest.id).catch(() => {
4381
- lastMarkedRef.current = null;
4382
- });
4383
- onMarkedRead?.(conversationId, latest.id);
4384
- }, [messages, meId, readReceipts, markReadUpTo, onMarkedRead, conversationId]);
5112
+ const latestId = latestMarkableId(messages);
5113
+ if (!latestId || latestId === lastMarkedRef.current) return;
5114
+ lastMarkedRef.current = latestId;
5115
+ markReadUpTo(latestId).then(
5116
+ () => onMarkedRead?.(conversationId, latestId),
5117
+ () => {
5118
+ if (lastMarkedRef.current === latestId) lastMarkedRef.current = null;
5119
+ }
5120
+ );
5121
+ }, [messages, markReadUpTo, onMarkedRead, conversationId]);
4385
5122
  const visibleMessages = react.useMemo(
4386
5123
  () => messages.filter((m) => react$1.isMessageVisibleTo(m, meId)),
4387
5124
  [messages, meId]
4388
5125
  );
5126
+ const [jump, setJump] = react.useState(null);
5127
+ const [pendingFocusId, setPendingFocusId] = react.useState(null);
5128
+ const [highlightId, setHighlightId] = react.useState(null);
5129
+ const [focusMissing, setFocusMissing] = react.useState(false);
5130
+ const onFocusNotFoundRef = react.useRef(onFocusMessageNotFound);
5131
+ onFocusNotFoundRef.current = onFocusMessageNotFound;
5132
+ const focusMiss = react.useCallback((id, report) => {
5133
+ setFocusMissing(true);
5134
+ if (report) onFocusNotFoundRef.current?.(id);
5135
+ }, []);
5136
+ const jumpTo = react.useCallback(
5137
+ (id, report) => {
5138
+ let current = true;
5139
+ loadUntil(id).then((found) => {
5140
+ if (!current) return;
5141
+ if (found) setPendingFocusId(id);
5142
+ else focusMiss(id, report);
5143
+ }).catch(() => {
5144
+ if (current) focusMiss(id, report);
5145
+ });
5146
+ return () => {
5147
+ current = false;
5148
+ };
5149
+ },
5150
+ [loadUntil, focusMiss]
5151
+ );
5152
+ react.useEffect(() => {
5153
+ setPendingFocusId(null);
5154
+ setFocusMissing(false);
5155
+ if (!focusMessageId || loading) return;
5156
+ return jumpTo(focusMessageId, true);
5157
+ }, [focusMessageId, conversationId, loading, jumpTo]);
5158
+ react.useEffect(() => {
5159
+ if (!pendingFocusId) return;
5160
+ setPendingFocusId(null);
5161
+ if (!visibleMessages.some((m) => m.id === pendingFocusId)) {
5162
+ focusMiss(pendingFocusId, true);
5163
+ return;
5164
+ }
5165
+ setJump((prev) => ({ id: pendingFocusId, request: (prev?.request ?? 0) + 1 }));
5166
+ setHighlightId(pendingFocusId);
5167
+ }, [pendingFocusId, visibleMessages, focusMiss]);
5168
+ react.useEffect(() => {
5169
+ if (!highlightId) return;
5170
+ const t = setTimeout(() => setHighlightId(null), 1600);
5171
+ return () => clearTimeout(t);
5172
+ }, [highlightId]);
5173
+ react.useEffect(() => {
5174
+ if (!focusMissing) return;
5175
+ const t = setTimeout(() => setFocusMissing(false), 4e3);
5176
+ return () => clearTimeout(t);
5177
+ }, [focusMissing]);
5178
+ const onQuotedClick = react.useCallback((id) => void jumpTo(id, false), [jumpTo]);
4389
5179
  const groupPositionById = react.useMemo(() => {
4390
5180
  const map = /* @__PURE__ */ new Map();
4391
5181
  for (let i = 0; i < visibleMessages.length; i++) {
@@ -4393,16 +5183,12 @@ function ConversationView({
4393
5183
  if (!msg) continue;
4394
5184
  const prev = i > 0 ? visibleMessages[i - 1] ?? null : null;
4395
5185
  const next = i < visibleMessages.length - 1 ? visibleMessages[i + 1] ?? null : null;
4396
- map.set(msg.id, react$1.computeGroupPosition(msg, prev, next, GROUPING_WINDOW_MS));
5186
+ map.set(msg.id, react$1.computeGroupPosition(msg, prev, next, groupWindowMinutes * 60 * 1e3));
4397
5187
  }
4398
5188
  return map;
4399
- }, [visibleMessages]);
4400
- const renderItem = react.useCallback(
4401
- (msg) => {
4402
- if (renderMessage) {
4403
- const custom = renderMessage(msg, meId);
4404
- if (custom !== null && custom !== void 0) return custom;
4405
- }
5189
+ }, [visibleMessages, groupWindowMinutes]);
5190
+ const defaultRow = react.useCallback(
5191
+ (msg, groupPosition) => {
4406
5192
  const readState = showReadState && meId !== null && msg.sender_id === meId ? readStateForMessage(msg, members, meId, sequenceByMessageId) : void 0;
4407
5193
  const isSelf = meId !== null && msg.sender_id === meId;
4408
5194
  const canEdit = react$1.canEditOwnMessage({
@@ -4412,8 +5198,7 @@ function ConversationView({
4412
5198
  readState,
4413
5199
  insertedAt: msg.inserted_at
4414
5200
  });
4415
- const groupPosition = groupPositionById.get(msg.id) ?? "standalone";
4416
- return /* @__PURE__ */ jsxRuntime.jsx(
5201
+ const row = /* @__PURE__ */ jsxRuntime.jsx(
4417
5202
  MessageRow,
4418
5203
  {
4419
5204
  msg,
@@ -4422,29 +5207,40 @@ function ConversationView({
4422
5207
  attachments,
4423
5208
  actions,
4424
5209
  threads,
4425
- quotations,
5210
+ quotations: canQuote,
4426
5211
  ...readState ? { readState } : {},
4427
5212
  isEditing: editingId === msg.id,
4428
5213
  ...canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {},
4429
5214
  onDelete: () => deleteMsg(msg.id),
4430
5215
  ...threads ? { onOpenThread: () => setThreadRoot(msg) } : {},
4431
- ...quotations ? { onQuote: () => setReplyingTo(msg) } : {},
5216
+ ...canQuote ? { onQuote: () => setReplyingTo(msg) } : {},
5217
+ onQuotedClick,
4432
5218
  ...labelFor ? { labelFor } : {},
4433
5219
  ...avatarFor ? { avatarFor } : {},
5220
+ ...onSenderPress ? { onSenderPress } : {},
5221
+ ...onAvatarPress ? { onAvatarPress } : {},
4434
5222
  showSenderName: showSenderLabels,
4435
5223
  showAvatar: showAvatars,
4436
5224
  maxBodyLength,
4437
5225
  groupPosition,
4438
5226
  markdown,
4439
- ...onCallBack ? { onCallBack } : {}
5227
+ ...onCallBack ? { onCallBack } : {},
5228
+ ...layoutProps,
5229
+ mentionsMe: mentionsViewer(msg, meId)
4440
5230
  }
4441
5231
  );
5232
+ if (msg.id !== highlightId) return row;
5233
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { backgroundColor: theme.colors.accentSoft }, children: row });
4442
5234
  },
4443
5235
  [
4444
5236
  onCallBack,
4445
- renderMessage,
5237
+ onQuotedClick,
5238
+ onSenderPress,
5239
+ onAvatarPress,
5240
+ highlightId,
5241
+ theme.colors.accentSoft,
5242
+ canQuote,
4446
5243
  meId,
4447
- readReceipts,
4448
5244
  showReadState,
4449
5245
  receiptsVisible,
4450
5246
  members,
@@ -4452,7 +5248,6 @@ function ConversationView({
4452
5248
  attachments,
4453
5249
  actions,
4454
5250
  threads,
4455
- quotations,
4456
5251
  editingId,
4457
5252
  deleteMsg,
4458
5253
  labelFor,
@@ -4461,10 +5256,26 @@ function ConversationView({
4461
5256
  showAvatars,
4462
5257
  maxBodyLength,
4463
5258
  sequenceByMessageId,
4464
- groupPositionById,
4465
- markdown
5259
+ markdown,
5260
+ layoutProps
4466
5261
  ]
4467
5262
  );
5263
+ const renderItem = react.useCallback(
5264
+ (msg) => {
5265
+ const groupPosition = groupPositionById.get(msg.id) ?? "standalone";
5266
+ if (renderMessage) {
5267
+ const custom = renderMessage(msg, meId, {
5268
+ layout,
5269
+ groupPosition,
5270
+ isRunStart: layout === "compact" || groupPosition === "first" || groupPosition === "standalone",
5271
+ renderDefault: () => defaultRow(msg, groupPosition)
5272
+ });
5273
+ if (custom !== null && custom !== void 0) return custom;
5274
+ }
5275
+ return defaultRow(msg, groupPosition);
5276
+ },
5277
+ [renderMessage, meId, layout, groupPositionById, defaultRow]
5278
+ );
4468
5279
  const editingMessage = react.useMemo(
4469
5280
  () => editingId ? messages.find((m) => m.id === editingId) ?? null : null,
4470
5281
  [editingId, messages]
@@ -4473,19 +5284,19 @@ function ConversationView({
4473
5284
  const out = [];
4474
5285
  let prev = null;
4475
5286
  for (const msg of visibleMessages) {
4476
- if (prev === null || !react$1.sameDay(msg.inserted_at, prev.inserted_at)) {
5287
+ if (daySeparators && (prev === null || !react$1.sameDay(msg.inserted_at, prev.inserted_at))) {
4477
5288
  const label = react$1.formatDayLabel(msg.inserted_at);
4478
5289
  out.push({
4479
5290
  kind: "separator",
4480
5291
  id: `sep-${msg.id}`,
4481
- node: /* @__PURE__ */ jsxRuntime.jsx(DaySeparator, { label })
5292
+ node: /* @__PURE__ */ jsxRuntime.jsx(DaySeparator, { label, variant: layout === "bubbles" ? "pill" : "rule" })
4482
5293
  });
4483
5294
  }
4484
5295
  out.push({ kind: "msg", msg });
4485
5296
  prev = msg;
4486
5297
  }
4487
5298
  return out;
4488
- }, [visibleMessages]);
5299
+ }, [visibleMessages, daySeparators, layout]);
4489
5300
  const composerProps = react.useMemo(
4490
5301
  () => ({
4491
5302
  onSend: async (body, opts) => {
@@ -4535,11 +5346,22 @@ function ConversationView({
4535
5346
  return /* @__PURE__ */ jsxRuntime.jsx(UploadProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4536
5347
  reactNative.KeyboardAvoidingView,
4537
5348
  {
4538
- style: [styles22.root, { backgroundColor: theme.colors.paper }],
5349
+ style: [styles23.root, { backgroundColor: theme.colors.background }],
4539
5350
  behavior: reactNative.Platform.OS === "ios" ? "padding" : "height",
4540
5351
  keyboardVerticalOffset: keyboardOffset,
4541
5352
  children: [
4542
5353
  headerNode,
5354
+ focusMissing ? /* @__PURE__ */ jsxRuntime.jsx(
5355
+ reactNative.Text,
5356
+ {
5357
+ style: [
5358
+ styles23.notice,
5359
+ { color: theme.colors.textMuted, backgroundColor: theme.colors.surfaceAlt }
5360
+ ],
5361
+ accessibilityRole: "alert",
5362
+ children: "That message isn't available."
5363
+ }
5364
+ ) : null,
4543
5365
  onJoinCall ? /* @__PURE__ */ jsxRuntime.jsx(
4544
5366
  JoinBanner,
4545
5367
  {
@@ -4549,7 +5371,7 @@ function ConversationView({
4549
5371
  onJoin: onJoinCall
4550
5372
  }
4551
5373
  ) : null,
4552
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles22.listWrap, children: [
5374
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.listWrap, children: [
4553
5375
  /* @__PURE__ */ jsxRuntime.jsx(
4554
5376
  MessageList,
4555
5377
  {
@@ -4560,12 +5382,14 @@ function ConversationView({
4560
5382
  hasMore,
4561
5383
  onLoadMore: loadMore,
4562
5384
  renderItem,
5385
+ scrollToMessageId: jump?.id ?? null,
5386
+ scrollRequest: jump?.request ?? 0,
4563
5387
  ListHeader: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
4564
5388
  visibleStreams.map(
4565
5389
  (stream) => stream.status === "failed" ? /* @__PURE__ */ jsxRuntime.jsx(
4566
5390
  reactNative.Text,
4567
5391
  {
4568
- style: [styles22.streamFailed, { color: theme.colors.ink3 }],
5392
+ style: [styles23.streamFailed, { color: theme.colors.textSubtle }],
4569
5393
  accessibilityRole: "alert",
4570
5394
  children: stream.error ? `The agent couldn't reply: ${stream.error}` : "The agent couldn't reply."
4571
5395
  },
@@ -4584,7 +5408,8 @@ function ConversationView({
4584
5408
  ...avatarFor ? { avatarFor } : {},
4585
5409
  showSenderName: showSenderLabels,
4586
5410
  showAvatar: showAvatars,
4587
- markdown
5411
+ markdown,
5412
+ ...layoutProps
4588
5413
  },
4589
5414
  stream.id
4590
5415
  )
@@ -4597,14 +5422,14 @@ function ConversationView({
4597
5422
  editingId ? /* @__PURE__ */ jsxRuntime.jsx(
4598
5423
  reactNative.Pressable,
4599
5424
  {
4600
- style: styles22.editBackdrop,
5425
+ style: [styles23.editBackdrop, { backgroundColor: theme.colors.overlay }],
4601
5426
  onPress: () => setEditingId(null),
4602
5427
  accessibilityLabel: "Cancel editing"
4603
5428
  }
4604
5429
  ) : null
4605
5430
  ] }),
4606
- mentions ? /* @__PURE__ */ jsxRuntime.jsx(MentionInput, { conversationId, ...composerProps }) : /* @__PURE__ */ jsxRuntime.jsx(MessageComposer, { ...composerProps }),
4607
- attachments ? /* @__PURE__ */ jsxRuntime.jsx(AttachmentPicker, { visible: pickerOpen, onClose: () => setPickerOpen(false) }) : null,
5431
+ !showComposer ? null : mentions ? /* @__PURE__ */ jsxRuntime.jsx(MentionInput, { conversationId, ...composerProps }) : /* @__PURE__ */ jsxRuntime.jsx(MessageComposer, { ...composerProps }),
5432
+ canAttach ? /* @__PURE__ */ jsxRuntime.jsx(AttachmentPicker, { visible: pickerOpen, onClose: () => setPickerOpen(false) }) : null,
4608
5433
  threads && threadRoot ? /* @__PURE__ */ jsxRuntime.jsx(
4609
5434
  ThreadView,
4610
5435
  {
@@ -4612,7 +5437,9 @@ function ConversationView({
4612
5437
  onClose: () => setThreadRoot(null),
4613
5438
  conversationId,
4614
5439
  rootMessage: threadRoot,
4615
- ...labelFor ? { labelFor } : {}
5440
+ ...labelFor ? { labelFor } : {},
5441
+ layout,
5442
+ ...timeFormat ? { timeFormat } : {}
4616
5443
  }
4617
5444
  ) : null
4618
5445
  ]
@@ -4643,10 +5470,16 @@ function readStateForMessage(msg, members, meId, sequenceByMessageId) {
4643
5470
  });
4644
5471
  return anyRead ? "read" : "sent";
4645
5472
  }
4646
- var styles22 = reactNative.StyleSheet.create({
5473
+ var styles23 = reactNative.StyleSheet.create({
4647
5474
  root: {
4648
5475
  flex: 1
4649
5476
  },
5477
+ notice: {
5478
+ fontSize: 12,
5479
+ fontWeight: "600",
5480
+ paddingHorizontal: 16,
5481
+ paddingVertical: 8
5482
+ },
4650
5483
  streamFailed: {
4651
5484
  fontSize: 12,
4652
5485
  marginHorizontal: 16,
@@ -4657,7 +5490,6 @@ var styles22 = reactNative.StyleSheet.create({
4657
5490
  },
4658
5491
  editBackdrop: {
4659
5492
  ...reactNative.StyleSheet.absoluteFillObject,
4660
- backgroundColor: "rgba(0,0,0,0.45)",
4661
5493
  // Sit above message rows by default but below any row that
4662
5494
  // explicitly elevates itself (MessageRow bumps zIndex/elevation
4663
5495
  // when isEditing is true).
@@ -4696,7 +5528,7 @@ function UserPickerSheet({
4696
5528
  title,
4697
5529
  searchable
4698
5530
  }) {
4699
- const theme = usePoolseTheme();
5531
+ const theme = useTheme();
4700
5532
  const [query, setQuery] = react.useState("");
4701
5533
  const [selectedIds, setSelectedIds] = react.useState([]);
4702
5534
  const [groupName, setGroupName] = react.useState("");
@@ -4759,17 +5591,17 @@ function UserPickerSheet({
4759
5591
  children: /* @__PURE__ */ jsxRuntime.jsxs(
4760
5592
  reactNative.View,
4761
5593
  {
4762
- style: styles23.modalRoot,
5594
+ style: styles24.modalRoot,
4763
5595
  onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
4764
5596
  children: [
4765
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles23.backdrop, onPress: handleClose }),
5597
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles24.backdrop, onPress: handleClose }),
4766
5598
  /* @__PURE__ */ jsxRuntime.jsx(
4767
5599
  reactNative.Animated.View,
4768
5600
  {
4769
5601
  style: [
4770
- styles23.sheet,
5602
+ styles24.sheet,
4771
5603
  {
4772
- backgroundColor: theme.colors.paper,
5604
+ backgroundColor: theme.colors.background,
4773
5605
  borderTopLeftRadius: theme.radii.xl,
4774
5606
  borderTopRightRadius: theme.radii.xl,
4775
5607
  height: sheetHeight,
@@ -4785,28 +5617,28 @@ function UserPickerSheet({
4785
5617
  children: /* @__PURE__ */ jsxRuntime.jsxs(
4786
5618
  reactNative.KeyboardAvoidingView,
4787
5619
  {
4788
- style: styles23.kav,
5620
+ style: styles24.kav,
4789
5621
  behavior: "padding",
4790
5622
  keyboardVerticalOffset: screenHeight - sheetHeight,
4791
5623
  children: [
4792
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ...panHandlers, style: styles23.dragHandle, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles23.dragPill, { backgroundColor: theme.colors.ink3 }] }) }),
4793
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.header, children: [
5624
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ...panHandlers, style: styles24.dragHandle, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles24.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
5625
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.header, children: [
4794
5626
  /* @__PURE__ */ jsxRuntime.jsx(
4795
5627
  reactNative.Pressable,
4796
5628
  {
4797
5629
  onPress: handleClose,
4798
5630
  hitSlop: 16,
4799
- style: [styles23.closeBtn, { backgroundColor: theme.colors.surface2 }],
5631
+ style: [styles24.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
4800
5632
  accessibilityLabel: "Close picker",
4801
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.ink })
5633
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
4802
5634
  }
4803
5635
  ),
4804
5636
  /* @__PURE__ */ jsxRuntime.jsx(
4805
5637
  reactNative.Text,
4806
5638
  {
4807
5639
  style: [
4808
- styles23.title,
4809
- { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
5640
+ styles24.title,
5641
+ { color: theme.colors.text, fontFamily: theme.fonts.display }
4810
5642
  ],
4811
5643
  numberOfLines: 1,
4812
5644
  children: heading
@@ -4819,9 +5651,9 @@ function UserPickerSheet({
4819
5651
  disabled: !canCreate,
4820
5652
  hitSlop: 6,
4821
5653
  style: [
4822
- styles23.createBtn,
5654
+ styles24.createBtn,
4823
5655
  {
4824
- backgroundColor: canCreate ? theme.colors.brand : theme.colors.surface2,
5656
+ backgroundColor: canCreate ? theme.colors.accent : theme.colors.surfaceAlt,
4825
5657
  opacity: canCreate ? 1 : 0.6
4826
5658
  }
4827
5659
  ],
@@ -4829,7 +5661,7 @@ function UserPickerSheet({
4829
5661
  reactNative.Text,
4830
5662
  {
4831
5663
  style: {
4832
- color: canCreate ? theme.colors.onBrand : theme.colors.ink3,
5664
+ color: canCreate ? theme.colors.accentText : theme.colors.textSubtle,
4833
5665
  fontWeight: "700",
4834
5666
  fontSize: 13
4835
5667
  },
@@ -4846,17 +5678,17 @@ function UserPickerSheet({
4846
5678
  reactNative.TextInput,
4847
5679
  {
4848
5680
  placeholder: "Group name",
4849
- placeholderTextColor: theme.colors.ink3,
5681
+ placeholderTextColor: theme.colors.textSubtle,
4850
5682
  value: groupName,
4851
5683
  onChangeText: setGroupName,
4852
5684
  style: [
4853
- styles23.groupNameInput,
5685
+ styles24.groupNameInput,
4854
5686
  {
4855
- color: theme.colors.ink,
4856
- backgroundColor: theme.colors.surface2,
5687
+ color: theme.colors.text,
5688
+ backgroundColor: theme.colors.surfaceAlt,
4857
5689
  borderRadius: theme.radii.md,
4858
- fontFamily: theme.type.fontBody,
4859
- fontSize: theme.type.bodySize
5690
+ fontFamily: theme.fonts.body,
5691
+ fontSize: theme.fonts.sizeMd
4860
5692
  }
4861
5693
  ]
4862
5694
  }
@@ -4865,16 +5697,16 @@ function UserPickerSheet({
4865
5697
  reactNative.TextInput,
4866
5698
  {
4867
5699
  placeholder: "Search\u2026",
4868
- placeholderTextColor: theme.colors.ink3,
5700
+ placeholderTextColor: theme.colors.textSubtle,
4869
5701
  value: query,
4870
5702
  onChangeText: setQuery,
4871
5703
  style: [
4872
- styles23.searchInput,
5704
+ styles24.searchInput,
4873
5705
  {
4874
- color: theme.colors.ink,
4875
- backgroundColor: theme.colors.surface2,
5706
+ color: theme.colors.text,
5707
+ backgroundColor: theme.colors.surfaceAlt,
4876
5708
  borderRadius: theme.radii.md,
4877
- fontFamily: theme.type.fontBody,
5709
+ fontFamily: theme.fonts.body,
4878
5710
  fontSize: 14
4879
5711
  }
4880
5712
  ]
@@ -4886,7 +5718,7 @@ function UserPickerSheet({
4886
5718
  data: filtered,
4887
5719
  keyExtractor: (u) => u.externalId,
4888
5720
  keyboardShouldPersistTaps: "handled",
4889
- ListEmptyComponent: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles23.empty, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles23.emptyText, { color: theme.colors.ink3 }], children: query ? "No matches." : "No users to show." }) }),
5721
+ ListEmptyComponent: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles24.empty, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.emptyText, { color: theme.colors.textSubtle }], children: query ? "No matches." : "No users to show." }) }),
4890
5722
  renderItem: ({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
4891
5723
  UserRow,
4892
5724
  {
@@ -4922,48 +5754,48 @@ function UserRow({
4922
5754
  isGroup,
4923
5755
  onPress
4924
5756
  }) {
4925
- const theme = usePoolseTheme();
5757
+ const theme = useTheme();
4926
5758
  return /* @__PURE__ */ jsxRuntime.jsxs(
4927
5759
  reactNative.Pressable,
4928
5760
  {
4929
5761
  onPress,
4930
5762
  style: [
4931
- styles23.row,
5763
+ styles24.row,
4932
5764
  {
4933
- backgroundColor: selected ? theme.colors.brandSoft : "transparent"
5765
+ backgroundColor: selected ? theme.colors.accentSoft : "transparent"
4934
5766
  }
4935
5767
  ],
4936
5768
  children: [
4937
- user.avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Image, { source: { uri: user.avatarUrl }, style: styles23.avatarImg }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
4938
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.body, children: [
5769
+ user.avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Image, { source: { uri: user.avatarUrl }, style: styles24.avatarImg }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
5770
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.body, children: [
4939
5771
  /* @__PURE__ */ jsxRuntime.jsx(
4940
5772
  reactNative.Text,
4941
5773
  {
4942
- style: [styles23.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }],
5774
+ style: [styles24.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
4943
5775
  numberOfLines: 1,
4944
5776
  children: user.name
4945
5777
  }
4946
5778
  ),
4947
- user.subtitle ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles23.subtitle, { color: theme.colors.ink3 }], numberOfLines: 1, children: user.subtitle }) : null
5779
+ user.subtitle ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: user.subtitle }) : null
4948
5780
  ] }),
4949
5781
  isGroup ? /* @__PURE__ */ jsxRuntime.jsx(
4950
5782
  reactNative.View,
4951
5783
  {
4952
5784
  style: [
4953
- styles23.checkbox,
5785
+ styles24.checkbox,
4954
5786
  {
4955
- borderColor: selected ? theme.colors.brand : theme.colors.border,
4956
- backgroundColor: selected ? theme.colors.brand : "transparent"
5787
+ borderColor: selected ? theme.colors.accent : theme.colors.border,
5788
+ backgroundColor: selected ? theme.colors.accent : "transparent"
4957
5789
  }
4958
5790
  ],
4959
- children: selected ? /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "check", size: 14, color: theme.colors.onBrand }) : null
5791
+ children: selected ? /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "check", size: 14, color: theme.colors.accentText }) : null
4960
5792
  }
4961
5793
  ) : null
4962
5794
  ]
4963
5795
  }
4964
5796
  );
4965
5797
  }
4966
- var styles23 = reactNative.StyleSheet.create({
5798
+ var styles24 = reactNative.StyleSheet.create({
4967
5799
  modalRoot: {
4968
5800
  flex: 1,
4969
5801
  justifyContent: "flex-end"
@@ -5079,7 +5911,7 @@ var PoolseInbox = react.forwardRef(
5079
5911
  emptyState,
5080
5912
  keyboardOffset = 0
5081
5913
  } = props;
5082
- const theme = usePoolseTheme();
5914
+ const theme = useTheme();
5083
5915
  const { width: screenWidth } = reactNative.useWindowDimensions();
5084
5916
  const { me } = react$1.useMe();
5085
5917
  const {
@@ -5227,7 +6059,7 @@ var PoolseInbox = react.forwardRef(
5227
6059
  },
5228
6060
  [renderConversationRow, meExternalId, meId, labelFor, avatarFor, unreadCounts]
5229
6061
  );
5230
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles24.root, { backgroundColor: theme.colors.paper }], children: [
6062
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles25.root, { backgroundColor: theme.colors.background }], children: [
5231
6063
  /* @__PURE__ */ jsxRuntime.jsxs(
5232
6064
  reactNative.Animated.View,
5233
6065
  {
@@ -5238,7 +6070,7 @@ var PoolseInbox = react.forwardRef(
5238
6070
  reactNative.View,
5239
6071
  {
5240
6072
  style: [
5241
- styles24.listHeader,
6073
+ styles25.listHeader,
5242
6074
  {
5243
6075
  backgroundColor: theme.colors.surface,
5244
6076
  borderBottomColor: theme.colors.border
@@ -5249,13 +6081,13 @@ var PoolseInbox = react.forwardRef(
5249
6081
  reactNative.Text,
5250
6082
  {
5251
6083
  style: [
5252
- styles24.listTitle,
5253
- { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
6084
+ styles25.listTitle,
6085
+ { color: theme.colors.text, fontFamily: theme.fonts.display }
5254
6086
  ],
5255
6087
  children: title
5256
6088
  }
5257
6089
  ),
5258
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.headerActions, children: [
6090
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles25.headerActions, children: [
5259
6091
  users ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5260
6092
  /* @__PURE__ */ jsxRuntime.jsx(
5261
6093
  HeaderIconButton,
@@ -5360,7 +6192,7 @@ function HeaderIconButton({
5360
6192
  onPress,
5361
6193
  label
5362
6194
  }) {
5363
- const theme = usePoolseTheme();
6195
+ const theme = useTheme();
5364
6196
  return /* @__PURE__ */ jsxRuntime.jsx(
5365
6197
  reactNative.Pressable,
5366
6198
  {
@@ -5368,12 +6200,12 @@ function HeaderIconButton({
5368
6200
  hitSlop: 10,
5369
6201
  accessibilityLabel: label,
5370
6202
  style: ({ pressed }) => [
5371
- styles24.iconBtn,
6203
+ styles25.iconBtn,
5372
6204
  {
5373
- backgroundColor: pressed ? theme.colors.surface2 : "transparent"
6205
+ backgroundColor: pressed ? theme.colors.surfaceAlt : "transparent"
5374
6206
  }
5375
6207
  ],
5376
- children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: icon, size: 20, color: theme.colors.ink })
6208
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: icon, size: 20, color: theme.colors.text })
5377
6209
  }
5378
6210
  );
5379
6211
  }
@@ -5387,7 +6219,7 @@ function DefaultConversationRow({
5387
6219
  avatarFor,
5388
6220
  onPress
5389
6221
  }) {
5390
- const theme = usePoolseTheme();
6222
+ const theme = useTheme();
5391
6223
  const isDirect = conv.type === "direct";
5392
6224
  const otherExtId = isDirect && meExternalId ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId) : null;
5393
6225
  const resolvedOther = react$1.useUser(isDirect ? otherExtId ?? null : null);
@@ -5399,31 +6231,31 @@ function DefaultConversationRow({
5399
6231
  {
5400
6232
  onPress,
5401
6233
  style: [
5402
- styles24.row,
6234
+ styles25.row,
5403
6235
  {
5404
- backgroundColor: selected ? theme.colors.surface2 : "transparent",
6236
+ backgroundColor: selected ? theme.colors.surfaceAlt : "transparent",
5405
6237
  borderBottomColor: theme.colors.border
5406
6238
  }
5407
6239
  ],
5408
6240
  children: [
5409
- avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Image, { source: { uri: avatarUrl }, style: styles24.rowAvatar }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: null, name: title, seed: avatarSeed, size: "md" }),
5410
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.rowBody, children: [
6241
+ avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Image, { source: { uri: avatarUrl }, style: styles25.rowAvatar }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: null, name: title, seed: avatarSeed, size: "md" }),
6242
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles25.rowBody, children: [
5411
6243
  /* @__PURE__ */ jsxRuntime.jsx(
5412
6244
  reactNative.Text,
5413
6245
  {
5414
- style: [styles24.rowTitle, { color: theme.colors.ink, fontFamily: theme.type.fontBody }],
6246
+ style: [styles25.rowTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
5415
6247
  numberOfLines: 1,
5416
6248
  children: title
5417
6249
  }
5418
6250
  ),
5419
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.rowSubtitle, { color: theme.colors.ink3 }], numberOfLines: 1, children: react$1.formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
6251
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles25.rowSubtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: react$1.formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
5420
6252
  ] }),
5421
- unread > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles24.unreadPill, { backgroundColor: theme.colors.unreadPill }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.unreadText, { color: theme.colors.unreadPillText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
6253
+ unread > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles25.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles25.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
5422
6254
  ]
5423
6255
  }
5424
6256
  );
5425
6257
  }
5426
- var styles24 = reactNative.StyleSheet.create({
6258
+ var styles25 = reactNative.StyleSheet.create({
5427
6259
  root: {
5428
6260
  flex: 1,
5429
6261
  overflow: "hidden"
@@ -5504,16 +6336,16 @@ var VARIANT_VB = {
5504
6336
  mono: { vb: [0, 0, 454, 100], aspect: 4.54 }
5505
6337
  };
5506
6338
  function PoolseLogo({ variant = "lockup", size = 28, color, label }) {
5507
- const theme = usePoolseTheme();
6339
+ const theme = useTheme();
5508
6340
  const mono = variant === "mono";
5509
- const monoColor = color ?? theme.colors.ink;
5510
- const tileFill = mono ? "none" : theme.colors.brand;
6341
+ const monoColor = color ?? theme.colors.text;
6342
+ const tileFill = mono ? "none" : theme.colors.accent;
5511
6343
  const tileStroke = mono ? monoColor : "transparent";
5512
6344
  const tileStrokeWidth = mono ? 5 : 0;
5513
- const pulseStroke = mono ? monoColor : theme.colors.onBrand;
5514
- const pulseDotFill = mono ? monoColor : theme.colors.onBrand;
5515
- const inkFill = mono ? monoColor : theme.colors.ink;
5516
- const oFill = mono ? monoColor : theme.colors.brand;
6345
+ const pulseStroke = mono ? monoColor : theme.colors.accentText;
6346
+ const pulseDotFill = mono ? monoColor : theme.colors.accentText;
6347
+ const inkFill = mono ? monoColor : theme.colors.text;
6348
+ const oFill = mono ? monoColor : theme.colors.accent;
5517
6349
  const { vb, aspect } = VARIANT_VB[variant];
5518
6350
  const width = size * aspect;
5519
6351
  const showMark = variant === "lockup" || variant === "mark" || variant === "mono";
@@ -5608,7 +6440,7 @@ function CallControlButton({
5608
6440
  const size = large ? CONTROL_SIZE_LARGE : CONTROL_SIZE;
5609
6441
  const background = tone === "danger" ? callColors.danger : tone === "accept" ? callColors.accept : active ? callColors.controlActive : callColors.control;
5610
6442
  const iconColor = tone === "neutral" && active ? callColors.controlActiveIcon : callColors.onAction;
5611
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles25.slot, children: [
6443
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles26.slot, children: [
5612
6444
  /* @__PURE__ */ jsxRuntime.jsx(
5613
6445
  reactNative.Pressable,
5614
6446
  {
@@ -5619,7 +6451,7 @@ function CallControlButton({
5619
6451
  accessibilityLabel: accessibilityLabel ?? label ?? icon,
5620
6452
  hitSlop: 8,
5621
6453
  style: ({ pressed }) => [
5622
- styles25.button,
6454
+ styles26.button,
5623
6455
  {
5624
6456
  width: size,
5625
6457
  height: size,
@@ -5633,10 +6465,10 @@ function CallControlButton({
5633
6465
  children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: icon, size: large ? 30 : 25, color: iconColor, label: null })
5634
6466
  }
5635
6467
  ),
5636
- label ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: styles25.label, children: label }) : null
6468
+ label ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: styles26.label, children: label }) : null
5637
6469
  ] });
5638
6470
  }
5639
- var styles25 = reactNative.StyleSheet.create({
6471
+ var styles26 = reactNative.StyleSheet.create({
5640
6472
  // Fixed width so captions of different lengths cannot shift the row.
5641
6473
  slot: { width: 76, alignItems: "center", gap: 7 },
5642
6474
  button: { alignItems: "center", justifyContent: "center" },
@@ -5649,7 +6481,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
5649
6481
  reactNative.View,
5650
6482
  {
5651
6483
  style: [
5652
- styles26.ring,
6484
+ styles27.ring,
5653
6485
  {
5654
6486
  width: outer,
5655
6487
  height: outer,
@@ -5662,7 +6494,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
5662
6494
  reactNative.View,
5663
6495
  {
5664
6496
  style: [
5665
- styles26.circle,
6497
+ styles27.circle,
5666
6498
  {
5667
6499
  width: size,
5668
6500
  height: size,
@@ -5673,7 +6505,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
5673
6505
  children: /* @__PURE__ */ jsxRuntime.jsx(
5674
6506
  reactNative.Text,
5675
6507
  {
5676
- style: [styles26.initials, { fontSize: Math.round(size * 0.38) }],
6508
+ style: [styles27.initials, { fontSize: Math.round(size * 0.38) }],
5677
6509
  numberOfLines: 1,
5678
6510
  allowFontScaling: false,
5679
6511
  children: initialsOf(name)
@@ -5690,7 +6522,7 @@ function initialsOf(name) {
5690
6522
  if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
5691
6523
  return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
5692
6524
  }
5693
- var styles26 = reactNative.StyleSheet.create({
6525
+ var styles27 = reactNative.StyleSheet.create({
5694
6526
  ring: { alignItems: "center", justifyContent: "center" },
5695
6527
  circle: { alignItems: "center", justifyContent: "center" },
5696
6528
  initials: { color: "#ffffff", fontWeight: "600" }
@@ -5718,15 +6550,15 @@ function AudioRouteSheet({
5718
6550
  animationType: "fade",
5719
6551
  onRequestClose: onClose,
5720
6552
  ...EDGE_TO_EDGE_MODAL,
5721
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles27.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxRuntime.jsxs(
6553
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: styles28.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxRuntime.jsxs(
5722
6554
  reactNative.Pressable,
5723
6555
  {
5724
- style: [styles27.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
6556
+ style: [styles28.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
5725
6557
  onPress: () => {
5726
6558
  },
5727
6559
  children: [
5728
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles27.grabber }),
5729
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles27.title, children: "Audio output" }),
6560
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles28.grabber }),
6561
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles28.title, children: "Audio output" }),
5730
6562
  routes.map((route) => {
5731
6563
  const selected = route.id === selectedRouteId;
5732
6564
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5738,7 +6570,7 @@ function AudioRouteSheet({
5738
6570
  },
5739
6571
  accessibilityRole: "button",
5740
6572
  accessibilityState: { selected },
5741
- style: ({ pressed }) => [styles27.row, pressed && styles27.rowPressed],
6573
+ style: ({ pressed }) => [styles28.row, pressed && styles28.rowPressed],
5742
6574
  children: [
5743
6575
  /* @__PURE__ */ jsxRuntime.jsx(
5744
6576
  PoolseIcon,
@@ -5749,7 +6581,7 @@ function AudioRouteSheet({
5749
6581
  label: null
5750
6582
  }
5751
6583
  ),
5752
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles27.label, selected && styles27.labelSelected], children: route.label }),
6584
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles28.label, selected && styles28.labelSelected], children: route.label }),
5753
6585
  selected && /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "check", size: 19, color: callColors.accept, label: "selected" })
5754
6586
  ]
5755
6587
  },
@@ -5762,7 +6594,7 @@ function AudioRouteSheet({
5762
6594
  }
5763
6595
  );
5764
6596
  }
5765
- var styles27 = reactNative.StyleSheet.create({
6597
+ var styles28 = reactNative.StyleSheet.create({
5766
6598
  backdrop: { flex: 1, backgroundColor: "rgba(0,0,0,0.55)", justifyContent: "flex-end" },
5767
6599
  sheet: {
5768
6600
  backgroundColor: callColors.tile,
@@ -5860,6 +6692,6 @@ exports.defaultLightTheme = defaultLightTheme;
5860
6692
  exports.useAppStateLifecycle = useAppStateLifecycle;
5861
6693
  exports.useCallDuration = useCallDuration;
5862
6694
  exports.useDisplayName = useDisplayName;
5863
- exports.usePoolseTheme = usePoolseTheme;
6695
+ exports.useTheme = useTheme;
5864
6696
  //# sourceMappingURL=index.cjs.map
5865
6697
  //# sourceMappingURL=index.cjs.map