@poolse/react-ui 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/README.md +41 -4
- package/dist/emojiData-DAL22PO7.js +856 -0
- package/dist/emojiData-DAL22PO7.js.map +1 -0
- package/dist/index.cjs +2487 -283
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +271 -24
- package/dist/index.d.ts +271 -24
- package/dist/index.js +1608 -285
- package/dist/index.js.map +1 -1
- package/dist/styles.css +733 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -13,7 +13,877 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
13
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
14
14
|
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
|
+
var __esm = (fn, res) => function __init() {
|
|
19
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/emojiData.ts
|
|
27
|
+
var emojiData_exports = {};
|
|
28
|
+
__export(emojiData_exports, {
|
|
29
|
+
EMOJI_CATEGORIES: () => EMOJI_CATEGORIES
|
|
30
|
+
});
|
|
31
|
+
var EMOJI_CATEGORIES;
|
|
32
|
+
var init_emojiData = __esm({
|
|
33
|
+
"src/emojiData.ts"() {
|
|
34
|
+
EMOJI_CATEGORIES = [
|
|
35
|
+
{
|
|
36
|
+
id: "smileys",
|
|
37
|
+
label: "Smileys & people",
|
|
38
|
+
emojis: [
|
|
39
|
+
["\u{1F600}", "grinning face"],
|
|
40
|
+
["\u{1F601}", "grinning face with smiling eyes"],
|
|
41
|
+
["\u{1F602}", "face with tears of joy lol laugh haha"],
|
|
42
|
+
["\u{1F603}", "smiling face with open mouth"],
|
|
43
|
+
["\u{1F604}", "smiling face with open mouth and smiling eyes happy"],
|
|
44
|
+
["\u{1F605}", "smiling face with open mouth and cold sweat"],
|
|
45
|
+
["\u{1F606}", "smiling face with open mouth and tightly closed eyes"],
|
|
46
|
+
["\u{1F607}", "smiling face with halo"],
|
|
47
|
+
["\u{1F608}", "smiling face with horns"],
|
|
48
|
+
["\u{1F609}", "winking face"],
|
|
49
|
+
["\u{1F60A}", "smiling face with smiling eyes happy smile"],
|
|
50
|
+
["\u{1F60B}", "face savouring delicious food"],
|
|
51
|
+
["\u{1F60C}", "relieved face"],
|
|
52
|
+
["\u{1F60D}", "smiling face with heart shaped eyes love crush"],
|
|
53
|
+
["\u{1F60E}", "smiling face with sunglasses"],
|
|
54
|
+
["\u{1F60F}", "smirking face"],
|
|
55
|
+
["\u{1F610}", "neutral face"],
|
|
56
|
+
["\u{1F611}", "expressionless face"],
|
|
57
|
+
["\u{1F612}", "unamused face"],
|
|
58
|
+
["\u{1F613}", "face with cold sweat"],
|
|
59
|
+
["\u{1F614}", "pensive face"],
|
|
60
|
+
["\u{1F615}", "confused face"],
|
|
61
|
+
["\u{1F616}", "confounded face"],
|
|
62
|
+
["\u{1F617}", "kissing face"],
|
|
63
|
+
["\u{1F618}", "face throwing a kiss"],
|
|
64
|
+
["\u{1F619}", "kissing face with smiling eyes"],
|
|
65
|
+
["\u{1F61A}", "kissing face with closed eyes"],
|
|
66
|
+
["\u{1F61B}", "face with stuck out tongue"],
|
|
67
|
+
["\u{1F61C}", "face with stuck out tongue and winking eye"],
|
|
68
|
+
["\u{1F61D}", "face with stuck out tongue and tightly closed eyes"],
|
|
69
|
+
["\u{1F61E}", "disappointed face"],
|
|
70
|
+
["\u{1F61F}", "worried face"],
|
|
71
|
+
["\u{1F620}", "angry face"],
|
|
72
|
+
["\u{1F621}", "pouting face"],
|
|
73
|
+
["\u{1F622}", "crying face sad"],
|
|
74
|
+
["\u{1F623}", "persevering face"],
|
|
75
|
+
["\u{1F624}", "face with look of triumph"],
|
|
76
|
+
["\u{1F625}", "disappointed but relieved face"],
|
|
77
|
+
["\u{1F626}", "frowning face with open mouth"],
|
|
78
|
+
["\u{1F627}", "anguished face"],
|
|
79
|
+
["\u{1F628}", "fearful face"],
|
|
80
|
+
["\u{1F629}", "weary face"],
|
|
81
|
+
["\u{1F62A}", "sleepy face"],
|
|
82
|
+
["\u{1F62B}", "tired face"],
|
|
83
|
+
["\u{1F62C}", "grimacing face"],
|
|
84
|
+
["\u{1F62D}", "loudly crying face sad sob"],
|
|
85
|
+
["\u{1F62E}", "face with open mouth"],
|
|
86
|
+
["\u{1F62F}", "hushed face"],
|
|
87
|
+
["\u{1F630}", "face with open mouth and cold sweat"],
|
|
88
|
+
["\u{1F631}", "face screaming in fear"],
|
|
89
|
+
["\u{1F632}", "astonished face"],
|
|
90
|
+
["\u{1F633}", "flushed face"],
|
|
91
|
+
["\u{1F634}", "sleeping face"],
|
|
92
|
+
["\u{1F635}", "dizzy face"],
|
|
93
|
+
["\u{1F636}", "face without mouth"],
|
|
94
|
+
["\u{1F637}", "face with medical mask"],
|
|
95
|
+
["\u{1F641}", "slightly frowning face"],
|
|
96
|
+
["\u{1F642}", "slightly smiling face smile"],
|
|
97
|
+
["\u{1F643}", "upside down face"],
|
|
98
|
+
["\u{1F644}", "face with rolling eyes eye roll"],
|
|
99
|
+
["\u{1F910}", "zipper mouth face"],
|
|
100
|
+
["\u{1F911}", "money mouth face"],
|
|
101
|
+
["\u{1F912}", "face with thermometer"],
|
|
102
|
+
["\u{1F913}", "nerd face"],
|
|
103
|
+
["\u{1F914}", "thinking face think hmm"],
|
|
104
|
+
["\u{1F915}", "face with head bandage"],
|
|
105
|
+
["\u{1F917}", "hugging face"],
|
|
106
|
+
["\u{1F918}", "sign of the horns"],
|
|
107
|
+
["\u{1F919}", "call me hand"],
|
|
108
|
+
["\u{1F91A}", "raised back of hand"],
|
|
109
|
+
["\u{1F91B}", "left facing fist"],
|
|
110
|
+
["\u{1F91C}", "right facing fist"],
|
|
111
|
+
["\u{1F91D}", "handshake"],
|
|
112
|
+
["\u{1F91E}", "hand with index and middle fingers crossed"],
|
|
113
|
+
["\u{1F91F}", "i love you hand sign"],
|
|
114
|
+
["\u{1F920}", "face with cowboy hat"],
|
|
115
|
+
["\u{1F921}", "clown face"],
|
|
116
|
+
["\u{1F922}", "nauseated face"],
|
|
117
|
+
["\u{1F923}", "rolling on the floor laughing"],
|
|
118
|
+
["\u{1F924}", "drooling face"],
|
|
119
|
+
["\u{1F925}", "lying face"],
|
|
120
|
+
["\u{1F926}", "face palm facepalm"],
|
|
121
|
+
["\u{1F927}", "sneezing face"],
|
|
122
|
+
["\u{1F928}", "face with one eyebrow raised"],
|
|
123
|
+
["\u{1F929}", "grinning face with star eyes"],
|
|
124
|
+
["\u{1F92A}", "grinning face with one large and one small eye"],
|
|
125
|
+
["\u{1F92B}", "face with finger covering closed lips"],
|
|
126
|
+
["\u{1F92C}", "serious face with symbols covering mouth"],
|
|
127
|
+
["\u{1F92D}", "smiling face with smiling eyes and hand covering mouth"],
|
|
128
|
+
["\u{1F92E}", "face with open mouth vomiting"],
|
|
129
|
+
["\u{1F92F}", "shocked face with exploding head"],
|
|
130
|
+
["\u{1F970}", "smiling face with smiling eyes and three hearts"],
|
|
131
|
+
["\u{1F971}", "yawning face"],
|
|
132
|
+
["\u{1F972}", "smiling face with tear"],
|
|
133
|
+
["\u{1F973}", "face with party horn and party hat"],
|
|
134
|
+
["\u{1F974}", "face with uneven eyes and wavy mouth"],
|
|
135
|
+
["\u{1F975}", "overheated face"],
|
|
136
|
+
["\u{1F976}", "freezing face"],
|
|
137
|
+
["\u{1F978}", "disguised face"],
|
|
138
|
+
["\u{1F97A}", "face with pleading eyes"],
|
|
139
|
+
["\u{1F9D0}", "face with monocle"],
|
|
140
|
+
["\u{1F648}", "see no evil monkey"],
|
|
141
|
+
["\u{1F649}", "hear no evil monkey"],
|
|
142
|
+
["\u{1F64A}", "speak no evil monkey"],
|
|
143
|
+
["\u{1F47B}", "ghost"],
|
|
144
|
+
["\u{1F480}", "skull"],
|
|
145
|
+
["\u{1F47D}", "extraterrestrial alien"],
|
|
146
|
+
["\u{1F916}", "robot face"],
|
|
147
|
+
["\u{1F4A9}", "pile of poo"],
|
|
148
|
+
["\u{1F47F}", "imp"],
|
|
149
|
+
["\u{1F44B}", "waving hand sign"],
|
|
150
|
+
["\u270B\uFE0F", "raised hand"],
|
|
151
|
+
["\u{1F596}", "raised hand with part between middle and ring fingers"],
|
|
152
|
+
["\u{1F44C}", "ok hand sign"],
|
|
153
|
+
["\u{1F90C}", "pinched fingers"],
|
|
154
|
+
["\u{1F90F}", "pinching hand"],
|
|
155
|
+
["\u270C\uFE0F", "victory hand"],
|
|
156
|
+
["\u{1F448}", "white left pointing backhand index"],
|
|
157
|
+
["\u{1F449}", "white right pointing backhand index"],
|
|
158
|
+
["\u{1F446}", "white up pointing backhand index"],
|
|
159
|
+
["\u{1F447}", "white down pointing backhand index"],
|
|
160
|
+
["\u261D\uFE0F", "white up pointing index"],
|
|
161
|
+
["\u{1F44D}", "thumbs up sign +1 like yes ok approve"],
|
|
162
|
+
["\u{1F44E}", "thumbs down sign -1 dislike no"],
|
|
163
|
+
["\u270A\uFE0F", "raised fist"],
|
|
164
|
+
["\u{1F44A}", "fisted hand sign"],
|
|
165
|
+
["\u{1F44F}", "clapping hands sign applause bravo"],
|
|
166
|
+
["\u{1F64C}", "person raising both hands in celebration"],
|
|
167
|
+
["\u{1F450}", "open hands sign"],
|
|
168
|
+
["\u{1F932}", "palms up together"],
|
|
169
|
+
["\u{1F64F}", "person with folded hands pray please thanks thank you"],
|
|
170
|
+
["\u270D\uFE0F", "writing hand"],
|
|
171
|
+
["\u{1F485}", "nail polish"],
|
|
172
|
+
["\u{1F933}", "selfie"],
|
|
173
|
+
["\u{1F4AA}", "flexed biceps"],
|
|
174
|
+
["\u{1F9BE}", "mechanical arm"],
|
|
175
|
+
["\u{1F440}", "eyes look see watching"],
|
|
176
|
+
["\u{1F9E0}", "brain"],
|
|
177
|
+
["\u{1F476}", "baby"],
|
|
178
|
+
["\u{1F9D2}", "child"],
|
|
179
|
+
["\u{1F466}", "boy"],
|
|
180
|
+
["\u{1F467}", "girl"],
|
|
181
|
+
["\u{1F9D1}", "adult"],
|
|
182
|
+
["\u{1F468}", "man"],
|
|
183
|
+
["\u{1F469}", "woman"],
|
|
184
|
+
["\u{1F9D3}", "older adult"],
|
|
185
|
+
["\u{1F474}", "older man"],
|
|
186
|
+
["\u{1F475}", "older woman"],
|
|
187
|
+
["\u{1F64B}", "happy person raising one hand"],
|
|
188
|
+
["\u{1F64D}", "person frowning"],
|
|
189
|
+
["\u{1F64E}", "person with pouting face"],
|
|
190
|
+
["\u{1F645}", "face with no good gesture"],
|
|
191
|
+
["\u{1F646}", "face with ok gesture"],
|
|
192
|
+
["\u{1F481}", "information desk person"],
|
|
193
|
+
["\u{1F937}", "shrug shrug idk"],
|
|
194
|
+
["\u{1F483}", "dancer"],
|
|
195
|
+
["\u{1F57A}", "man dancing"],
|
|
196
|
+
["\u{1F46F}", "woman with bunny ears"],
|
|
197
|
+
["\u2764\uFE0F", "heavy black heart love"],
|
|
198
|
+
["\u{1F9E1}", "orange heart"],
|
|
199
|
+
["\u{1F49B}", "yellow heart"],
|
|
200
|
+
["\u{1F49A}", "green heart"],
|
|
201
|
+
["\u{1F499}", "blue heart"],
|
|
202
|
+
["\u{1F49C}", "purple heart"],
|
|
203
|
+
["\u{1F5A4}", "black heart"],
|
|
204
|
+
["\u{1F90D}", "white heart"],
|
|
205
|
+
["\u{1F90E}", "brown heart"],
|
|
206
|
+
["\u{1F494}", "broken heart"],
|
|
207
|
+
["\u2763\uFE0F", "heavy heart exclamation mark ornament"],
|
|
208
|
+
["\u{1F495}", "two hearts"],
|
|
209
|
+
["\u{1F49E}", "revolving hearts"],
|
|
210
|
+
["\u{1F493}", "beating heart"],
|
|
211
|
+
["\u{1F497}", "growing heart"],
|
|
212
|
+
["\u{1F496}", "sparkling heart"],
|
|
213
|
+
["\u{1F498}", "heart with arrow"],
|
|
214
|
+
["\u{1F49D}", "heart with ribbon"],
|
|
215
|
+
["\u{1F48B}", "kiss mark"],
|
|
216
|
+
["\u{1F4AF}", "hundred points symbol hundred perfect"],
|
|
217
|
+
["\u{1F4A2}", "anger symbol"],
|
|
218
|
+
["\u{1F4A5}", "collision symbol"],
|
|
219
|
+
["\u{1F4AB}", "dizzy symbol"],
|
|
220
|
+
["\u{1F4A6}", "splashing sweat symbol"],
|
|
221
|
+
["\u{1F4A8}", "dash symbol"],
|
|
222
|
+
["\u{1F4AC}", "speech balloon"],
|
|
223
|
+
["\u{1F4AD}", "thought balloon"],
|
|
224
|
+
["\u{1F4A4}", "sleeping symbol"]
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: "nature",
|
|
229
|
+
label: "Animals & nature",
|
|
230
|
+
emojis: [
|
|
231
|
+
["\u{1F400}", "rat"],
|
|
232
|
+
["\u{1F401}", "mouse"],
|
|
233
|
+
["\u{1F402}", "ox"],
|
|
234
|
+
["\u{1F403}", "water buffalo"],
|
|
235
|
+
["\u{1F404}", "cow"],
|
|
236
|
+
["\u{1F405}", "tiger"],
|
|
237
|
+
["\u{1F406}", "leopard"],
|
|
238
|
+
["\u{1F407}", "rabbit"],
|
|
239
|
+
["\u{1F408}", "cat"],
|
|
240
|
+
["\u{1F409}", "dragon"],
|
|
241
|
+
["\u{1F40A}", "crocodile"],
|
|
242
|
+
["\u{1F40B}", "whale"],
|
|
243
|
+
["\u{1F40C}", "snail"],
|
|
244
|
+
["\u{1F40D}", "snake"],
|
|
245
|
+
["\u{1F40E}", "horse"],
|
|
246
|
+
["\u{1F40F}", "ram"],
|
|
247
|
+
["\u{1F410}", "goat"],
|
|
248
|
+
["\u{1F411}", "sheep"],
|
|
249
|
+
["\u{1F412}", "monkey"],
|
|
250
|
+
["\u{1F413}", "rooster"],
|
|
251
|
+
["\u{1F414}", "chicken"],
|
|
252
|
+
["\u{1F415}", "dog"],
|
|
253
|
+
["\u{1F416}", "pig"],
|
|
254
|
+
["\u{1F417}", "boar"],
|
|
255
|
+
["\u{1F418}", "elephant"],
|
|
256
|
+
["\u{1F419}", "octopus"],
|
|
257
|
+
["\u{1F41A}", "spiral shell"],
|
|
258
|
+
["\u{1F41B}", "bug"],
|
|
259
|
+
["\u{1F41C}", "ant"],
|
|
260
|
+
["\u{1F41D}", "honeybee"],
|
|
261
|
+
["\u{1F41E}", "lady beetle"],
|
|
262
|
+
["\u{1F41F}", "fish"],
|
|
263
|
+
["\u{1F420}", "tropical fish"],
|
|
264
|
+
["\u{1F421}", "blowfish"],
|
|
265
|
+
["\u{1F422}", "turtle"],
|
|
266
|
+
["\u{1F423}", "hatching chick"],
|
|
267
|
+
["\u{1F424}", "baby chick"],
|
|
268
|
+
["\u{1F425}", "front facing baby chick"],
|
|
269
|
+
["\u{1F426}", "bird"],
|
|
270
|
+
["\u{1F427}", "penguin"],
|
|
271
|
+
["\u{1F428}", "koala"],
|
|
272
|
+
["\u{1F429}", "poodle"],
|
|
273
|
+
["\u{1F42A}", "dromedary camel"],
|
|
274
|
+
["\u{1F42B}", "bactrian camel"],
|
|
275
|
+
["\u{1F42C}", "dolphin"],
|
|
276
|
+
["\u{1F42D}", "mouse face"],
|
|
277
|
+
["\u{1F42E}", "cow face"],
|
|
278
|
+
["\u{1F42F}", "tiger face"],
|
|
279
|
+
["\u{1F430}", "rabbit face"],
|
|
280
|
+
["\u{1F431}", "cat face"],
|
|
281
|
+
["\u{1F432}", "dragon face"],
|
|
282
|
+
["\u{1F433}", "spouting whale"],
|
|
283
|
+
["\u{1F434}", "horse face"],
|
|
284
|
+
["\u{1F435}", "monkey face"],
|
|
285
|
+
["\u{1F436}", "dog face"],
|
|
286
|
+
["\u{1F437}", "pig face"],
|
|
287
|
+
["\u{1F438}", "frog face"],
|
|
288
|
+
["\u{1F439}", "hamster face"],
|
|
289
|
+
["\u{1F43A}", "wolf face"],
|
|
290
|
+
["\u{1F43B}", "bear face"],
|
|
291
|
+
["\u{1F43C}", "panda face"],
|
|
292
|
+
["\u{1F43D}", "pig nose"],
|
|
293
|
+
["\u{1F43E}", "paw prints"],
|
|
294
|
+
["\u{1F980}", "crab"],
|
|
295
|
+
["\u{1F981}", "lion face"],
|
|
296
|
+
["\u{1F982}", "scorpion"],
|
|
297
|
+
["\u{1F983}", "turkey"],
|
|
298
|
+
["\u{1F984}", "unicorn face"],
|
|
299
|
+
["\u{1F985}", "eagle"],
|
|
300
|
+
["\u{1F986}", "duck"],
|
|
301
|
+
["\u{1F987}", "bat"],
|
|
302
|
+
["\u{1F988}", "shark"],
|
|
303
|
+
["\u{1F989}", "owl"],
|
|
304
|
+
["\u{1F98A}", "fox face"],
|
|
305
|
+
["\u{1F98B}", "butterfly"],
|
|
306
|
+
["\u{1F98C}", "deer"],
|
|
307
|
+
["\u{1F98D}", "gorilla"],
|
|
308
|
+
["\u{1F98E}", "lizard"],
|
|
309
|
+
["\u{1F98F}", "rhinoceros"],
|
|
310
|
+
["\u{1F990}", "shrimp"],
|
|
311
|
+
["\u{1F991}", "squid"],
|
|
312
|
+
["\u{1F992}", "giraffe face"],
|
|
313
|
+
["\u{1F993}", "zebra face"],
|
|
314
|
+
["\u{1F994}", "hedgehog"],
|
|
315
|
+
["\u{1F995}", "sauropod"],
|
|
316
|
+
["\u{1F996}", "t rex"],
|
|
317
|
+
["\u{1F997}", "cricket"],
|
|
318
|
+
["\u{1F99A}", "peacock"],
|
|
319
|
+
["\u{1F99C}", "parrot"],
|
|
320
|
+
["\u{1F99D}", "raccoon"],
|
|
321
|
+
["\u{1F99E}", "lobster"],
|
|
322
|
+
["\u{1F99F}", "mosquito"],
|
|
323
|
+
["\u{1F331}", "seedling"],
|
|
324
|
+
["\u{1F332}", "evergreen tree"],
|
|
325
|
+
["\u{1F333}", "deciduous tree"],
|
|
326
|
+
["\u{1F334}", "palm tree"],
|
|
327
|
+
["\u{1F335}", "cactus"],
|
|
328
|
+
["\u{1F337}", "tulip"],
|
|
329
|
+
["\u{1F338}", "cherry blossom"],
|
|
330
|
+
["\u{1F339}", "rose"],
|
|
331
|
+
["\u{1F33A}", "hibiscus"],
|
|
332
|
+
["\u{1F33B}", "sunflower"],
|
|
333
|
+
["\u{1F33C}", "blossom"],
|
|
334
|
+
["\u{1F33D}", "ear of maize"],
|
|
335
|
+
["\u{1F33E}", "ear of rice"],
|
|
336
|
+
["\u{1F33F}", "herb"],
|
|
337
|
+
["\u{1F340}", "four leaf clover"],
|
|
338
|
+
["\u{1F341}", "maple leaf"],
|
|
339
|
+
["\u{1F342}", "fallen leaf"],
|
|
340
|
+
["\u{1F343}", "leaf fluttering in wind"],
|
|
341
|
+
["\u{1F344}", "mushroom"],
|
|
342
|
+
["\u{1F490}", "bouquet"],
|
|
343
|
+
["\u{1F940}", "wilted flower"],
|
|
344
|
+
["\u{1F311}", "new moon symbol"],
|
|
345
|
+
["\u{1F315}", "full moon symbol"],
|
|
346
|
+
["\u{1F319}", "crescent moon"],
|
|
347
|
+
["\u{1F31A}", "new moon with face"],
|
|
348
|
+
["\u{1F31E}", "sun with face"],
|
|
349
|
+
["\u{1F31D}", "full moon with face"],
|
|
350
|
+
["\u2600\uFE0F", "black sun with rays"],
|
|
351
|
+
["\u2B50\uFE0F", "white medium star"],
|
|
352
|
+
["\u{1F31F}", "glowing star"],
|
|
353
|
+
["\u{1F320}", "shooting star"],
|
|
354
|
+
["\u2601\uFE0F", "cloud"],
|
|
355
|
+
["\u26C5\uFE0F", "sun behind cloud"],
|
|
356
|
+
["\u{1F308}", "rainbow"],
|
|
357
|
+
["\u2744\uFE0F", "snowflake"],
|
|
358
|
+
["\u2603\uFE0F", "snowman"],
|
|
359
|
+
["\u26C4\uFE0F", "snowman without snow"],
|
|
360
|
+
["\u{1F525}", "fire fire lit hot"],
|
|
361
|
+
["\u{1F4A7}", "droplet"],
|
|
362
|
+
["\u{1F30A}", "water wave"]
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: "food",
|
|
367
|
+
label: "Food & drink",
|
|
368
|
+
emojis: [
|
|
369
|
+
["\u{1F345}", "tomato"],
|
|
370
|
+
["\u{1F346}", "aubergine"],
|
|
371
|
+
["\u{1F347}", "grapes"],
|
|
372
|
+
["\u{1F348}", "melon"],
|
|
373
|
+
["\u{1F349}", "watermelon"],
|
|
374
|
+
["\u{1F34A}", "tangerine"],
|
|
375
|
+
["\u{1F34B}", "lemon"],
|
|
376
|
+
["\u{1F34C}", "banana"],
|
|
377
|
+
["\u{1F34D}", "pineapple"],
|
|
378
|
+
["\u{1F34E}", "red apple"],
|
|
379
|
+
["\u{1F34F}", "green apple"],
|
|
380
|
+
["\u{1F350}", "pear"],
|
|
381
|
+
["\u{1F351}", "peach"],
|
|
382
|
+
["\u{1F352}", "cherries"],
|
|
383
|
+
["\u{1F353}", "strawberry"],
|
|
384
|
+
["\u{1F354}", "hamburger"],
|
|
385
|
+
["\u{1F355}", "slice of pizza"],
|
|
386
|
+
["\u{1F356}", "meat on bone"],
|
|
387
|
+
["\u{1F357}", "poultry leg"],
|
|
388
|
+
["\u{1F358}", "rice cracker"],
|
|
389
|
+
["\u{1F359}", "rice ball"],
|
|
390
|
+
["\u{1F35A}", "cooked rice"],
|
|
391
|
+
["\u{1F35B}", "curry and rice"],
|
|
392
|
+
["\u{1F35C}", "steaming bowl"],
|
|
393
|
+
["\u{1F35D}", "spaghetti"],
|
|
394
|
+
["\u{1F35E}", "bread"],
|
|
395
|
+
["\u{1F35F}", "french fries"],
|
|
396
|
+
["\u{1F360}", "roasted sweet potato"],
|
|
397
|
+
["\u{1F361}", "dango"],
|
|
398
|
+
["\u{1F362}", "oden"],
|
|
399
|
+
["\u{1F363}", "sushi"],
|
|
400
|
+
["\u{1F364}", "fried shrimp"],
|
|
401
|
+
["\u{1F365}", "fish cake with swirl design"],
|
|
402
|
+
["\u{1F366}", "soft ice cream"],
|
|
403
|
+
["\u{1F367}", "shaved ice"],
|
|
404
|
+
["\u{1F368}", "ice cream"],
|
|
405
|
+
["\u{1F369}", "doughnut"],
|
|
406
|
+
["\u{1F36A}", "cookie"],
|
|
407
|
+
["\u{1F36B}", "chocolate bar"],
|
|
408
|
+
["\u{1F36C}", "candy"],
|
|
409
|
+
["\u{1F36D}", "lollipop"],
|
|
410
|
+
["\u{1F36E}", "custard"],
|
|
411
|
+
["\u{1F36F}", "honey pot"],
|
|
412
|
+
["\u{1F370}", "shortcake"],
|
|
413
|
+
["\u{1F371}", "bento box"],
|
|
414
|
+
["\u{1F372}", "pot of food"],
|
|
415
|
+
["\u{1F373}", "cooking"],
|
|
416
|
+
["\u{1F374}", "fork and knife"],
|
|
417
|
+
["\u{1F375}", "teacup without handle"],
|
|
418
|
+
["\u{1F376}", "sake bottle and cup"],
|
|
419
|
+
["\u{1F377}", "wine glass"],
|
|
420
|
+
["\u{1F378}", "cocktail glass"],
|
|
421
|
+
["\u{1F379}", "tropical drink"],
|
|
422
|
+
["\u{1F37A}", "beer mug"],
|
|
423
|
+
["\u{1F37B}", "clinking beer mugs"],
|
|
424
|
+
["\u{1F37C}", "baby bottle"],
|
|
425
|
+
["\u{1F950}", "croissant"],
|
|
426
|
+
["\u{1F951}", "avocado"],
|
|
427
|
+
["\u{1F952}", "cucumber"],
|
|
428
|
+
["\u{1F953}", "bacon"],
|
|
429
|
+
["\u{1F954}", "potato"],
|
|
430
|
+
["\u{1F955}", "carrot"],
|
|
431
|
+
["\u{1F956}", "baguette bread"],
|
|
432
|
+
["\u{1F957}", "green salad"],
|
|
433
|
+
["\u{1F958}", "shallow pan of food"],
|
|
434
|
+
["\u{1F959}", "stuffed flatbread"],
|
|
435
|
+
["\u{1F95A}", "egg"],
|
|
436
|
+
["\u{1F95B}", "glass of milk"],
|
|
437
|
+
["\u{1F95C}", "peanuts"],
|
|
438
|
+
["\u{1F95D}", "kiwifruit"],
|
|
439
|
+
["\u{1F95E}", "pancakes"],
|
|
440
|
+
["\u{1F95F}", "dumpling"],
|
|
441
|
+
["\u{1F960}", "fortune cookie"],
|
|
442
|
+
["\u{1F961}", "takeout box"],
|
|
443
|
+
["\u{1F962}", "chopsticks"],
|
|
444
|
+
["\u{1F963}", "bowl with spoon"],
|
|
445
|
+
["\u{1F964}", "cup with straw"],
|
|
446
|
+
["\u{1F965}", "coconut"],
|
|
447
|
+
["\u{1F966}", "broccoli"],
|
|
448
|
+
["\u{1F967}", "pie"],
|
|
449
|
+
["\u{1F968}", "pretzel"],
|
|
450
|
+
["\u{1F969}", "cut of meat"],
|
|
451
|
+
["\u{1F96A}", "sandwich"],
|
|
452
|
+
["\u{1F96B}", "canned food"],
|
|
453
|
+
["\u{1F96C}", "leafy green"],
|
|
454
|
+
["\u{1F96D}", "mango"],
|
|
455
|
+
["\u{1F96E}", "moon cake"],
|
|
456
|
+
["\u{1F96F}", "bagel"],
|
|
457
|
+
["\u{1F9C0}", "cheese wedge"],
|
|
458
|
+
["\u{1F9C1}", "cupcake"],
|
|
459
|
+
["\u{1F9C2}", "salt shaker"],
|
|
460
|
+
["\u{1F9C3}", "beverage box"],
|
|
461
|
+
["\u{1F9C4}", "garlic"],
|
|
462
|
+
["\u{1F9C5}", "onion"],
|
|
463
|
+
["\u{1F9C6}", "falafel"],
|
|
464
|
+
["\u{1F9C7}", "waffle"],
|
|
465
|
+
["\u{1F9C8}", "butter"],
|
|
466
|
+
["\u{1F9C9}", "mate drink"],
|
|
467
|
+
["\u{1F9CA}", "ice cube"],
|
|
468
|
+
["\u{1F9CB}", "bubble tea"],
|
|
469
|
+
["\u{1F37E}", "bottle with popping cork"],
|
|
470
|
+
["\u{1F37F}", "popcorn"],
|
|
471
|
+
["\u2615\uFE0F", "hot beverage"]
|
|
472
|
+
]
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
id: "activity",
|
|
476
|
+
label: "Activities",
|
|
477
|
+
emojis: [
|
|
478
|
+
["\u{1F380}", "ribbon"],
|
|
479
|
+
["\u{1F381}", "wrapped present"],
|
|
480
|
+
["\u{1F382}", "birthday cake"],
|
|
481
|
+
["\u{1F383}", "jack o lantern"],
|
|
482
|
+
["\u{1F384}", "christmas tree"],
|
|
483
|
+
["\u{1F385}", "father christmas"],
|
|
484
|
+
["\u{1F386}", "fireworks"],
|
|
485
|
+
["\u{1F387}", "firework sparkler"],
|
|
486
|
+
["\u{1F388}", "balloon"],
|
|
487
|
+
["\u{1F389}", "party popper party tada celebrate congrats"],
|
|
488
|
+
["\u{1F38A}", "confetti ball"],
|
|
489
|
+
["\u{1F38B}", "tanabata tree"],
|
|
490
|
+
["\u{1F38C}", "crossed flags"],
|
|
491
|
+
["\u{1F38D}", "pine decoration"],
|
|
492
|
+
["\u{1F38E}", "japanese dolls"],
|
|
493
|
+
["\u{1F38F}", "carp streamer"],
|
|
494
|
+
["\u{1F390}", "wind chime"],
|
|
495
|
+
["\u{1F391}", "moon viewing ceremony"],
|
|
496
|
+
["\u{1F392}", "school satchel"],
|
|
497
|
+
["\u{1F393}", "graduation cap"],
|
|
498
|
+
["\u{1F9E8}", "firecracker"],
|
|
499
|
+
["\u2728\uFE0F", "sparkles"],
|
|
500
|
+
["\u26BD\uFE0F", "soccer ball"],
|
|
501
|
+
["\u26BE\uFE0F", "baseball"],
|
|
502
|
+
["\u{1F94E}", "softball"],
|
|
503
|
+
["\u{1F3C0}", "basketball and hoop"],
|
|
504
|
+
["\u{1F3D0}", "volleyball"],
|
|
505
|
+
["\u{1F3C8}", "american football"],
|
|
506
|
+
["\u{1F3C9}", "rugby football"],
|
|
507
|
+
["\u{1F3BE}", "tennis racquet and ball"],
|
|
508
|
+
["\u{1F94F}", "flying disc"],
|
|
509
|
+
["\u{1F3B3}", "bowling"],
|
|
510
|
+
["\u{1F3CF}", "cricket bat and ball"],
|
|
511
|
+
["\u{1F3D1}", "field hockey stick and ball"],
|
|
512
|
+
["\u{1F3D2}", "ice hockey stick and puck"],
|
|
513
|
+
["\u{1F94D}", "lacrosse stick and ball"],
|
|
514
|
+
["\u{1F3D3}", "table tennis paddle and ball"],
|
|
515
|
+
["\u{1F3F8}", "badminton racquet and shuttlecock"],
|
|
516
|
+
["\u{1F94A}", "boxing glove"],
|
|
517
|
+
["\u{1F94B}", "martial arts uniform"],
|
|
518
|
+
["\u{1F945}", "goal net"],
|
|
519
|
+
["\u26F3\uFE0F", "flag in hole"],
|
|
520
|
+
["\u26F8\uFE0F", "ice skate"],
|
|
521
|
+
["\u{1F3A3}", "fishing pole and fish"],
|
|
522
|
+
["\u{1F93F}", "diving mask"],
|
|
523
|
+
["\u{1F3BD}", "running shirt with sash"],
|
|
524
|
+
["\u{1F3BF}", "ski and ski boot"],
|
|
525
|
+
["\u{1F6F7}", "sled"],
|
|
526
|
+
["\u{1F94C}", "curling stone"],
|
|
527
|
+
["\u{1F3AF}", "direct hit"],
|
|
528
|
+
["\u{1F3B1}", "billiards"],
|
|
529
|
+
["\u{1F52E}", "crystal ball"],
|
|
530
|
+
["\u{1F3AE}", "video game"],
|
|
531
|
+
["\u{1F3B0}", "slot machine"],
|
|
532
|
+
["\u{1F3B2}", "game die"],
|
|
533
|
+
["\u{1F9E9}", "jigsaw puzzle piece"],
|
|
534
|
+
["\u265F\uFE0F", "black chess pawn"],
|
|
535
|
+
["\u{1F3AD}", "performing arts"],
|
|
536
|
+
["\u{1F3A8}", "artist palette"],
|
|
537
|
+
["\u{1F9F5}", "spool of thread"],
|
|
538
|
+
["\u{1F9F6}", "ball of yarn"],
|
|
539
|
+
["\u{1F3A4}", "microphone"],
|
|
540
|
+
["\u{1F3A7}", "headphone"],
|
|
541
|
+
["\u{1F3BC}", "musical score"],
|
|
542
|
+
["\u{1F3B5}", "musical note"],
|
|
543
|
+
["\u{1F3B6}", "multiple musical notes"],
|
|
544
|
+
["\u{1F3B7}", "saxophone"],
|
|
545
|
+
["\u{1F3B8}", "guitar"],
|
|
546
|
+
["\u{1F3B9}", "musical keyboard"],
|
|
547
|
+
["\u{1F3BA}", "trumpet"],
|
|
548
|
+
["\u{1F3BB}", "violin"],
|
|
549
|
+
["\u{1F941}", "drum with drumsticks"],
|
|
550
|
+
["\u{1F3AC}", "clapper board"],
|
|
551
|
+
["\u{1F3C6}", "trophy"],
|
|
552
|
+
["\u{1F3C5}", "sports medal"],
|
|
553
|
+
["\u{1F947}", "first place medal"],
|
|
554
|
+
["\u{1F948}", "second place medal"],
|
|
555
|
+
["\u{1F949}", "third place medal"],
|
|
556
|
+
["\u{1F3AB}", "ticket"]
|
|
557
|
+
]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: "travel",
|
|
561
|
+
label: "Travel & places",
|
|
562
|
+
emojis: [
|
|
563
|
+
["\u{1F680}", "rocket launch ship"],
|
|
564
|
+
["\u{1F681}", "helicopter"],
|
|
565
|
+
["\u{1F682}", "steam locomotive"],
|
|
566
|
+
["\u{1F683}", "railway car"],
|
|
567
|
+
["\u{1F684}", "high speed train"],
|
|
568
|
+
["\u{1F685}", "high speed train with bullet nose"],
|
|
569
|
+
["\u{1F686}", "train"],
|
|
570
|
+
["\u{1F687}", "metro"],
|
|
571
|
+
["\u{1F688}", "light rail"],
|
|
572
|
+
["\u{1F689}", "station"],
|
|
573
|
+
["\u{1F68A}", "tram"],
|
|
574
|
+
["\u{1F68B}", "tram car"],
|
|
575
|
+
["\u{1F68C}", "bus"],
|
|
576
|
+
["\u{1F68D}", "oncoming bus"],
|
|
577
|
+
["\u{1F68E}", "trolleybus"],
|
|
578
|
+
["\u{1F68F}", "bus stop"],
|
|
579
|
+
["\u{1F690}", "minibus"],
|
|
580
|
+
["\u{1F691}", "ambulance"],
|
|
581
|
+
["\u{1F692}", "fire engine"],
|
|
582
|
+
["\u{1F693}", "police car"],
|
|
583
|
+
["\u{1F694}", "oncoming police car"],
|
|
584
|
+
["\u{1F695}", "taxi"],
|
|
585
|
+
["\u{1F696}", "oncoming taxi"],
|
|
586
|
+
["\u{1F697}", "automobile"],
|
|
587
|
+
["\u{1F698}", "oncoming automobile"],
|
|
588
|
+
["\u{1F699}", "recreational vehicle"],
|
|
589
|
+
["\u{1F69A}", "delivery truck"],
|
|
590
|
+
["\u{1F69B}", "articulated lorry"],
|
|
591
|
+
["\u{1F69C}", "tractor"],
|
|
592
|
+
["\u{1F69D}", "monorail"],
|
|
593
|
+
["\u{1F69E}", "mountain railway"],
|
|
594
|
+
["\u{1F69F}", "suspension railway"],
|
|
595
|
+
["\u{1F6A0}", "mountain cableway"],
|
|
596
|
+
["\u{1F6A1}", "aerial tramway"],
|
|
597
|
+
["\u{1F6A2}", "ship"],
|
|
598
|
+
["\u{1F6A3}", "rowboat"],
|
|
599
|
+
["\u{1F6A4}", "speedboat"],
|
|
600
|
+
["\u{1F6B2}", "bicycle"],
|
|
601
|
+
["\u{1F6F4}", "scooter"],
|
|
602
|
+
["\u{1F6F5}", "motor scooter"],
|
|
603
|
+
["\u{1F6F6}", "canoe"],
|
|
604
|
+
["\u{1F6F8}", "flying saucer"],
|
|
605
|
+
["\u{1F6F9}", "skateboard"],
|
|
606
|
+
["\u2708\uFE0F", "airplane"],
|
|
607
|
+
["\u26F5\uFE0F", "sailboat"],
|
|
608
|
+
["\u2693\uFE0F", "anchor"],
|
|
609
|
+
["\u26FD\uFE0F", "fuel pump"],
|
|
610
|
+
["\u{1F6A7}", "construction sign"],
|
|
611
|
+
["\u{1F3E0}", "house building"],
|
|
612
|
+
["\u{1F3E1}", "house with garden"],
|
|
613
|
+
["\u{1F3E2}", "office building"],
|
|
614
|
+
["\u{1F3E3}", "japanese post office"],
|
|
615
|
+
["\u{1F3E4}", "european post office"],
|
|
616
|
+
["\u{1F3E5}", "hospital"],
|
|
617
|
+
["\u{1F3E6}", "bank"],
|
|
618
|
+
["\u{1F3E7}", "automated teller machine"],
|
|
619
|
+
["\u{1F3E8}", "hotel"],
|
|
620
|
+
["\u{1F3E9}", "love hotel"],
|
|
621
|
+
["\u{1F3EA}", "convenience store"],
|
|
622
|
+
["\u{1F3EB}", "school"],
|
|
623
|
+
["\u{1F3EC}", "department store"],
|
|
624
|
+
["\u{1F3ED}", "factory"],
|
|
625
|
+
["\u{1F3EE}", "izakaya lantern"],
|
|
626
|
+
["\u{1F3EF}", "japanese castle"],
|
|
627
|
+
["\u{1F3F0}", "european castle"],
|
|
628
|
+
["\u{1F5FC}", "tokyo tower"],
|
|
629
|
+
["\u{1F5FD}", "statue of liberty"],
|
|
630
|
+
["\u{1F5FE}", "silhouette of japan"],
|
|
631
|
+
["\u{1F5FF}", "moyai"],
|
|
632
|
+
["\u26EA\uFE0F", "church"],
|
|
633
|
+
["\u{1F54C}", "mosque"],
|
|
634
|
+
["\u{1F54D}", "synagogue"],
|
|
635
|
+
["\u26F2\uFE0F", "fountain"],
|
|
636
|
+
["\u26FA\uFE0F", "tent"],
|
|
637
|
+
["\u{1F301}", "foggy"],
|
|
638
|
+
["\u{1F303}", "night with stars"],
|
|
639
|
+
["\u{1F304}", "sunrise over mountains"],
|
|
640
|
+
["\u{1F305}", "sunrise"],
|
|
641
|
+
["\u{1F306}", "cityscape at dusk"],
|
|
642
|
+
["\u{1F307}", "sunset over buildings"],
|
|
643
|
+
["\u{1F309}", "bridge at night"],
|
|
644
|
+
["\u{1F30C}", "milky way"],
|
|
645
|
+
["\u{1F30D}", "earth globe europe africa"],
|
|
646
|
+
["\u{1F30E}", "earth globe americas"],
|
|
647
|
+
["\u{1F30F}", "earth globe asia australia"],
|
|
648
|
+
["\u{1F310}", "globe with meridians"],
|
|
649
|
+
["\u{1F5FA}\uFE0F", "world map"],
|
|
650
|
+
["\u{1F3A0}", "carousel horse"],
|
|
651
|
+
["\u{1F3A1}", "ferris wheel"],
|
|
652
|
+
["\u{1F3A2}", "roller coaster"]
|
|
653
|
+
]
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
id: "objects",
|
|
657
|
+
label: "Objects",
|
|
658
|
+
emojis: [
|
|
659
|
+
["\u231A\uFE0F", "watch"],
|
|
660
|
+
["\u{1F4F1}", "mobile phone"],
|
|
661
|
+
["\u{1F4F2}", "mobile phone with rightwards arrow at left"],
|
|
662
|
+
["\u{1F4BB}", "personal computer"],
|
|
663
|
+
["\u2328\uFE0F", "keyboard"],
|
|
664
|
+
["\u{1F4BD}", "minidisc"],
|
|
665
|
+
["\u{1F4BE}", "floppy disk"],
|
|
666
|
+
["\u{1F4BF}", "optical disc"],
|
|
667
|
+
["\u{1F4C0}", "dvd"],
|
|
668
|
+
["\u{1F4F7}", "camera"],
|
|
669
|
+
["\u{1F4F8}", "camera with flash"],
|
|
670
|
+
["\u{1F4F9}", "video camera"],
|
|
671
|
+
["\u{1F3A5}", "movie camera"],
|
|
672
|
+
["\u{1F4FA}", "television"],
|
|
673
|
+
["\u{1F4FB}", "radio"],
|
|
674
|
+
["\u23F0\uFE0F", "alarm clock"],
|
|
675
|
+
["\u23F3\uFE0F", "hourglass with flowing sand"],
|
|
676
|
+
["\u231B\uFE0F", "hourglass"],
|
|
677
|
+
["\u{1F4E1}", "satellite antenna"],
|
|
678
|
+
["\u{1F50B}", "battery"],
|
|
679
|
+
["\u{1F50C}", "electric plug"],
|
|
680
|
+
["\u{1F4A1}", "electric light bulb"],
|
|
681
|
+
["\u{1F526}", "electric torch"],
|
|
682
|
+
["\u{1F56F}\uFE0F", "candle"],
|
|
683
|
+
["\u{1F4B8}", "money with wings"],
|
|
684
|
+
["\u{1F4B5}", "banknote with dollar sign"],
|
|
685
|
+
["\u{1F4B4}", "banknote with yen sign"],
|
|
686
|
+
["\u{1F4B6}", "banknote with euro sign"],
|
|
687
|
+
["\u{1F4B7}", "banknote with pound sign"],
|
|
688
|
+
["\u{1F4B0}", "money bag"],
|
|
689
|
+
["\u{1F4B3}", "credit card"],
|
|
690
|
+
["\u{1F48E}", "gem stone"],
|
|
691
|
+
["\u2696\uFE0F", "scales"],
|
|
692
|
+
["\u{1F527}", "wrench"],
|
|
693
|
+
["\u{1F528}", "hammer"],
|
|
694
|
+
["\u2692\uFE0F", "hammer and pick"],
|
|
695
|
+
["\u{1F529}", "nut and bolt"],
|
|
696
|
+
["\u2699\uFE0F", "gear"],
|
|
697
|
+
["\u{1F9F0}", "toolbox"],
|
|
698
|
+
["\u{1F9F2}", "magnet"],
|
|
699
|
+
["\u{1F9EA}", "test tube"],
|
|
700
|
+
["\u{1F52D}", "telescope"],
|
|
701
|
+
["\u{1F52C}", "microscope"],
|
|
702
|
+
["\u{1F48A}", "pill"],
|
|
703
|
+
["\u{1F489}", "syringe"],
|
|
704
|
+
["\u{1F9EC}", "dna double helix"],
|
|
705
|
+
["\u{1F9F9}", "broom"],
|
|
706
|
+
["\u{1F9FA}", "basket"],
|
|
707
|
+
["\u{1F6BD}", "toilet"],
|
|
708
|
+
["\u{1F6BF}", "shower"],
|
|
709
|
+
["\u{1F6C1}", "bathtub"],
|
|
710
|
+
["\u{1F9FC}", "bar of soap"],
|
|
711
|
+
["\u{1F511}", "key"],
|
|
712
|
+
["\u{1F5DD}\uFE0F", "old key"],
|
|
713
|
+
["\u{1F6AA}", "door"],
|
|
714
|
+
["\u{1F6CF}\uFE0F", "bed"],
|
|
715
|
+
["\u{1F4E9}", "envelope with downwards arrow above"],
|
|
716
|
+
["\u{1F4E8}", "incoming envelope"],
|
|
717
|
+
["\u{1F4E7}", "e mail symbol"],
|
|
718
|
+
["\u{1F48C}", "love letter"],
|
|
719
|
+
["\u{1F4E5}", "inbox tray"],
|
|
720
|
+
["\u{1F4E4}", "outbox tray"],
|
|
721
|
+
["\u{1F4E6}", "package"],
|
|
722
|
+
["\u{1F4EB}", "closed mailbox with raised flag"],
|
|
723
|
+
["\u{1F4EE}", "postbox"],
|
|
724
|
+
["\u{1F4DD}", "memo"],
|
|
725
|
+
["\u{1F4BC}", "briefcase"],
|
|
726
|
+
["\u{1F4C1}", "file folder"],
|
|
727
|
+
["\u{1F4C2}", "open file folder"],
|
|
728
|
+
["\u{1F4C5}", "calendar"],
|
|
729
|
+
["\u{1F4C6}", "tear off calendar"],
|
|
730
|
+
["\u{1F4C7}", "card index"],
|
|
731
|
+
["\u{1F4C8}", "chart with upwards trend"],
|
|
732
|
+
["\u{1F4C9}", "chart with downwards trend"],
|
|
733
|
+
["\u{1F4CA}", "bar chart"],
|
|
734
|
+
["\u{1F4CB}", "clipboard"],
|
|
735
|
+
["\u{1F4CC}", "pushpin"],
|
|
736
|
+
["\u{1F4CD}", "round pushpin"],
|
|
737
|
+
["\u{1F4CE}", "paperclip"],
|
|
738
|
+
["\u{1F4CF}", "straight ruler"],
|
|
739
|
+
["\u{1F4D0}", "triangular ruler"],
|
|
740
|
+
["\u2702\uFE0F", "black scissors"],
|
|
741
|
+
["\u{1F4D3}", "notebook"],
|
|
742
|
+
["\u{1F4D4}", "notebook with decorative cover"],
|
|
743
|
+
["\u{1F4D2}", "ledger"],
|
|
744
|
+
["\u{1F4D5}", "closed book"],
|
|
745
|
+
["\u{1F4D7}", "green book"],
|
|
746
|
+
["\u{1F4D8}", "blue book"],
|
|
747
|
+
["\u{1F4D9}", "orange book"],
|
|
748
|
+
["\u{1F4DA}", "books"],
|
|
749
|
+
["\u{1F4D6}", "open book"],
|
|
750
|
+
["\u{1F516}", "bookmark"],
|
|
751
|
+
["\u{1F517}", "link symbol"],
|
|
752
|
+
["\u{1F4F0}", "newspaper"],
|
|
753
|
+
["\u270F\uFE0F", "pencil"],
|
|
754
|
+
["\u2712\uFE0F", "black nib"],
|
|
755
|
+
["\u{1F58A}\uFE0F", "lower left ballpoint pen"],
|
|
756
|
+
["\u{1F58B}\uFE0F", "lower left fountain pen"],
|
|
757
|
+
["\u{1F58C}\uFE0F", "lower left paintbrush"],
|
|
758
|
+
["\u{1F58D}\uFE0F", "lower left crayon"],
|
|
759
|
+
["\u{1F50D}", "left pointing magnifying glass"],
|
|
760
|
+
["\u{1F50E}", "right pointing magnifying glass"],
|
|
761
|
+
["\u{1F512}", "lock"],
|
|
762
|
+
["\u{1F513}", "open lock"],
|
|
763
|
+
["\u{1F50F}", "lock with ink pen"],
|
|
764
|
+
["\u{1F510}", "closed lock with key"],
|
|
765
|
+
["\u{1F514}", "bell"],
|
|
766
|
+
["\u{1F515}", "bell with cancellation stroke"],
|
|
767
|
+
["\u{1F4E3}", "cheering megaphone"],
|
|
768
|
+
["\u{1F4E2}", "public address loudspeaker"],
|
|
769
|
+
["\u{1F3F7}\uFE0F", "label"]
|
|
770
|
+
]
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
id: "symbols",
|
|
774
|
+
label: "Symbols",
|
|
775
|
+
emojis: [
|
|
776
|
+
["\u2705\uFE0F", "white heavy check mark done yes ok check"],
|
|
777
|
+
["\u2714\uFE0F", "heavy check mark"],
|
|
778
|
+
["\u2611\uFE0F", "ballot box with check"],
|
|
779
|
+
["\u274C\uFE0F", "cross mark"],
|
|
780
|
+
["\u274E\uFE0F", "negative squared cross mark"],
|
|
781
|
+
["\u2795\uFE0F", "heavy plus sign"],
|
|
782
|
+
["\u2796\uFE0F", "heavy minus sign"],
|
|
783
|
+
["\u2797\uFE0F", "heavy division sign"],
|
|
784
|
+
["\u2716\uFE0F", "heavy multiplication x"],
|
|
785
|
+
["\u267E\uFE0F", "permanent paper sign"],
|
|
786
|
+
["\u203C\uFE0F", "double exclamation mark"],
|
|
787
|
+
["\u2049\uFE0F", "exclamation question mark"],
|
|
788
|
+
["\u2753\uFE0F", "black question mark ornament"],
|
|
789
|
+
["\u2754\uFE0F", "white question mark ornament"],
|
|
790
|
+
["\u2755\uFE0F", "white exclamation mark ornament"],
|
|
791
|
+
["\u2757\uFE0F", "heavy exclamation mark symbol"],
|
|
792
|
+
["\u3030\uFE0F", "wavy dash"],
|
|
793
|
+
["\u26A0\uFE0F", "warning sign"],
|
|
794
|
+
["\u{1F6AB}", "no entry sign"],
|
|
795
|
+
["\u26D4\uFE0F", "no entry"],
|
|
796
|
+
["\u{1F6B3}", "no bicycles"],
|
|
797
|
+
["\u{1F6AD}", "no smoking symbol"],
|
|
798
|
+
["\u{1F51E}", "no one under eighteen symbol"],
|
|
799
|
+
["\u2622\uFE0F", "radioactive sign"],
|
|
800
|
+
["\u2623\uFE0F", "biohazard sign"],
|
|
801
|
+
["\u2B06\uFE0F", "upwards black arrow"],
|
|
802
|
+
["\u2197\uFE0F", "north east arrow"],
|
|
803
|
+
["\u27A1\uFE0F", "black rightwards arrow"],
|
|
804
|
+
["\u2198\uFE0F", "south east arrow"],
|
|
805
|
+
["\u2B07\uFE0F", "downwards black arrow"],
|
|
806
|
+
["\u2199\uFE0F", "south west arrow"],
|
|
807
|
+
["\u2B05\uFE0F", "leftwards black arrow"],
|
|
808
|
+
["\u2196\uFE0F", "north west arrow"],
|
|
809
|
+
["\u2195\uFE0F", "up down arrow"],
|
|
810
|
+
["\u2194\uFE0F", "left right arrow"],
|
|
811
|
+
["\u21A9\uFE0F", "leftwards arrow with hook"],
|
|
812
|
+
["\u21AA\uFE0F", "rightwards arrow with hook"],
|
|
813
|
+
["\u{1F504}", "anticlockwise downwards and upwards open circle arrows"],
|
|
814
|
+
["\u{1F503}", "clockwise downwards and upwards open circle arrows"],
|
|
815
|
+
["\u{1F519}", "back with leftwards arrow above"],
|
|
816
|
+
["\u{1F51A}", "end with leftwards arrow above"],
|
|
817
|
+
["\u{1F51B}", "on with exclamation mark with left right arrow above"],
|
|
818
|
+
["\u{1F51C}", "soon with rightwards arrow above"],
|
|
819
|
+
["\u{1F51D}", "top with upwards arrow above"],
|
|
820
|
+
["\u267B\uFE0F", "black universal recycling symbol"],
|
|
821
|
+
["\u269C\uFE0F", "fleur de lis"],
|
|
822
|
+
["\u{1F531}", "trident emblem"],
|
|
823
|
+
["\u{1F4DB}", "name badge"],
|
|
824
|
+
["\u{1F530}", "japanese symbol for beginner"],
|
|
825
|
+
["\u2B55\uFE0F", "heavy large circle"],
|
|
826
|
+
["\u{1F197}", "squared ok"],
|
|
827
|
+
["\u{1F195}", "squared new"],
|
|
828
|
+
["\u{1F193}", "squared free"],
|
|
829
|
+
["\u{1F192}", "squared cool"],
|
|
830
|
+
["\u{1F199}", "squared up with exclamation mark"],
|
|
831
|
+
["\u{1F196}", "squared ng"],
|
|
832
|
+
["\u{1F198}", "squared sos"],
|
|
833
|
+
["\u{1F6D1}", "octagonal sign"],
|
|
834
|
+
["\u{1F4F4}", "mobile phone off"],
|
|
835
|
+
["\u{1F4F3}", "vibration mode"],
|
|
836
|
+
["\u{1F534}", "large red circle"],
|
|
837
|
+
["\u{1F7E0}", "large orange circle"],
|
|
838
|
+
["\u{1F7E1}", "large yellow circle"],
|
|
839
|
+
["\u{1F7E2}", "large green circle"],
|
|
840
|
+
["\u{1F535}", "large blue circle"],
|
|
841
|
+
["\u{1F7E3}", "large purple circle"],
|
|
842
|
+
["\u{1F7E4}", "large brown circle"],
|
|
843
|
+
["\u26AB\uFE0F", "medium black circle"],
|
|
844
|
+
["\u26AA\uFE0F", "medium white circle"],
|
|
845
|
+
["\u{1F7E5}", "large red square"],
|
|
846
|
+
["\u{1F7E7}", "large orange square"],
|
|
847
|
+
["\u{1F7E8}", "large yellow square"],
|
|
848
|
+
["\u{1F7E9}", "large green square"],
|
|
849
|
+
["\u{1F7E6}", "large blue square"],
|
|
850
|
+
["\u{1F7EA}", "large purple square"],
|
|
851
|
+
["\u{1F7EB}", "large brown square"],
|
|
852
|
+
["\u2B1B\uFE0F", "black large square"],
|
|
853
|
+
["\u2B1C\uFE0F", "white large square"],
|
|
854
|
+
["\u{1F536}", "large orange diamond"],
|
|
855
|
+
["\u{1F537}", "large blue diamond"],
|
|
856
|
+
["\u{1F538}", "small orange diamond"],
|
|
857
|
+
["\u{1F539}", "small blue diamond"],
|
|
858
|
+
["\u{1F53A}", "up pointing red triangle"],
|
|
859
|
+
["\u{1F53B}", "down pointing red triangle"],
|
|
860
|
+
["\u{1F4A0}", "diamond shape with a dot inside"],
|
|
861
|
+
["\u{1F518}", "radio button"],
|
|
862
|
+
["\u2660\uFE0F", "black spade suit"],
|
|
863
|
+
["\u2663\uFE0F", "black club suit"],
|
|
864
|
+
["\u2665\uFE0F", "black heart suit"],
|
|
865
|
+
["\u2666\uFE0F", "black diamond suit"],
|
|
866
|
+
["\u{1F0CF}", "playing card black joker"],
|
|
867
|
+
["\u{1F3B4}", "flower playing cards"],
|
|
868
|
+
["\u{1F004}", "mahjong tile red dragon"],
|
|
869
|
+
["\u{1F552}\uFE0F", "clock face three oclock"],
|
|
870
|
+
["\u{1F4F6}", "antenna with bars"],
|
|
871
|
+
["\u{1F6BB}", "restroom"],
|
|
872
|
+
["\u{1F6B9}", "mens symbol"],
|
|
873
|
+
["\u{1F6BA}", "womens symbol"],
|
|
874
|
+
["\u267F\uFE0F", "wheelchair symbol"],
|
|
875
|
+
["\u{1F17F}", "negative squared latin capital letter p"],
|
|
876
|
+
["\u2139\uFE0F", "information source"],
|
|
877
|
+
["\u{1F523}", "input symbol for symbols"],
|
|
878
|
+
["\u{1F524}", "input symbol for latin letters"],
|
|
879
|
+
["\u{1F521}", "input symbol for latin small letters"],
|
|
880
|
+
["\u{1F522}", "input symbol for numbers"],
|
|
881
|
+
["\u{1F520}", "input symbol for latin capital letters"]
|
|
882
|
+
]
|
|
883
|
+
}
|
|
884
|
+
];
|
|
885
|
+
}
|
|
886
|
+
});
|
|
17
887
|
|
|
18
888
|
// src/icons-data.ts
|
|
19
889
|
var ICONS = {
|
|
@@ -753,6 +1623,85 @@ function PoolseFonts() {
|
|
|
753
1623
|
return null;
|
|
754
1624
|
}
|
|
755
1625
|
|
|
1626
|
+
// src/drafts.ts
|
|
1627
|
+
var localDraftStorage = {
|
|
1628
|
+
get: (key) => {
|
|
1629
|
+
try {
|
|
1630
|
+
return globalThis.localStorage?.getItem(key) ?? null;
|
|
1631
|
+
} catch {
|
|
1632
|
+
return null;
|
|
1633
|
+
}
|
|
1634
|
+
},
|
|
1635
|
+
set: (key, value) => {
|
|
1636
|
+
try {
|
|
1637
|
+
globalThis.localStorage?.setItem(key, value);
|
|
1638
|
+
} catch {
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
remove: (key) => {
|
|
1642
|
+
try {
|
|
1643
|
+
globalThis.localStorage?.removeItem(key);
|
|
1644
|
+
} catch {
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
var memory = /* @__PURE__ */ new Map();
|
|
1649
|
+
function draftKey(userId, conversationId) {
|
|
1650
|
+
return `poolse:draft:${userId}:${conversationId}`;
|
|
1651
|
+
}
|
|
1652
|
+
var isEmpty = (d) => d.text.trim() === "" && !d.replyTo;
|
|
1653
|
+
function readDraft(storage, key) {
|
|
1654
|
+
const held = memory.get(key);
|
|
1655
|
+
if (held) return held;
|
|
1656
|
+
let raw;
|
|
1657
|
+
try {
|
|
1658
|
+
raw = storage.get(key);
|
|
1659
|
+
} catch {
|
|
1660
|
+
return null;
|
|
1661
|
+
}
|
|
1662
|
+
const hold = (d) => {
|
|
1663
|
+
if (d && !memory.has(key)) memory.set(key, d);
|
|
1664
|
+
return memory.get(key) ?? d;
|
|
1665
|
+
};
|
|
1666
|
+
if (raw instanceof Promise)
|
|
1667
|
+
return raw.then(
|
|
1668
|
+
(r) => hold(parse(r)),
|
|
1669
|
+
() => null
|
|
1670
|
+
);
|
|
1671
|
+
return hold(parse(raw));
|
|
1672
|
+
}
|
|
1673
|
+
function writeDraft(storage, key, draft) {
|
|
1674
|
+
if (isEmpty(draft)) {
|
|
1675
|
+
clearDraft(storage, key);
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
memory.set(key, draft);
|
|
1679
|
+
const value = JSON.stringify({ v: 1, text: draft.text, replyTo: draft.replyTo });
|
|
1680
|
+
try {
|
|
1681
|
+
void Promise.resolve(storage.set(key, value)).catch(() => void 0);
|
|
1682
|
+
} catch {
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
function clearDraft(storage, key) {
|
|
1686
|
+
memory.delete(key);
|
|
1687
|
+
try {
|
|
1688
|
+
void Promise.resolve(storage.remove(key)).catch(() => void 0);
|
|
1689
|
+
} catch {
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
function parse(raw) {
|
|
1693
|
+
if (!raw) return null;
|
|
1694
|
+
try {
|
|
1695
|
+
const v = JSON.parse(raw);
|
|
1696
|
+
const text = typeof v.text === "string" ? v.text : "";
|
|
1697
|
+
const replyTo = v.replyTo && typeof v.replyTo === "object" && typeof v.replyTo.id === "string" ? v.replyTo : null;
|
|
1698
|
+
const draft = { text, replyTo };
|
|
1699
|
+
return isEmpty(draft) ? null : draft;
|
|
1700
|
+
} catch {
|
|
1701
|
+
return null;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
|
|
756
1705
|
// src/layout.ts
|
|
757
1706
|
function formatMessageTime(iso, format) {
|
|
758
1707
|
if (!iso) return "";
|
|
@@ -797,6 +1746,488 @@ function LiveCallBanner({ call, inCall, onJoin }) {
|
|
|
797
1746
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "poolse-live-call__join", onClick: () => onJoin(call), children: "Join" })
|
|
798
1747
|
] });
|
|
799
1748
|
}
|
|
1749
|
+
function formatRelativeTime(iso, now = Date.now()) {
|
|
1750
|
+
if (!iso) return "";
|
|
1751
|
+
const then = new Date(iso).getTime();
|
|
1752
|
+
if (Number.isNaN(then)) return "";
|
|
1753
|
+
const sec = Math.max(0, Math.floor((now - then) / 1e3));
|
|
1754
|
+
if (sec < 60) return "just now";
|
|
1755
|
+
if (sec < 3600) return `${Math.floor(sec / 60)}m ago`;
|
|
1756
|
+
if (sec < 86400) return `${Math.floor(sec / 3600)}h ago`;
|
|
1757
|
+
const days = Math.floor(sec / 86400);
|
|
1758
|
+
if (days === 1) return "yesterday";
|
|
1759
|
+
if (days < 7) return `${days}d ago`;
|
|
1760
|
+
const date = new Date(then);
|
|
1761
|
+
const sameYear = date.getFullYear() === new Date(now).getFullYear();
|
|
1762
|
+
return date.toLocaleDateString(void 0, {
|
|
1763
|
+
month: "short",
|
|
1764
|
+
day: "numeric",
|
|
1765
|
+
...sameYear ? {} : { year: "numeric" }
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
function useNow(intervalMs = 6e4) {
|
|
1769
|
+
const [now, setNow] = react.useState(() => Date.now());
|
|
1770
|
+
react.useEffect(() => {
|
|
1771
|
+
const t = setInterval(() => setNow(Date.now()), intervalMs);
|
|
1772
|
+
return () => clearInterval(t);
|
|
1773
|
+
}, [intervalMs]);
|
|
1774
|
+
return now;
|
|
1775
|
+
}
|
|
1776
|
+
function PresenceBadge({
|
|
1777
|
+
state,
|
|
1778
|
+
doNotDisturb = false,
|
|
1779
|
+
size = "md",
|
|
1780
|
+
className
|
|
1781
|
+
}) {
|
|
1782
|
+
if (!state || state === "offline") return null;
|
|
1783
|
+
const kind = doNotDisturb ? "dnd" : state;
|
|
1784
|
+
const label = doNotDisturb ? "Do not disturb" : presenceStateLabel(state);
|
|
1785
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1786
|
+
"span",
|
|
1787
|
+
{
|
|
1788
|
+
className: [
|
|
1789
|
+
"poolse-presence-badge",
|
|
1790
|
+
`poolse-presence-badge--${kind}`,
|
|
1791
|
+
`poolse-presence-badge--${size}`,
|
|
1792
|
+
className
|
|
1793
|
+
].filter(Boolean).join(" "),
|
|
1794
|
+
role: "img",
|
|
1795
|
+
"aria-label": label,
|
|
1796
|
+
title: label,
|
|
1797
|
+
"data-presence": kind,
|
|
1798
|
+
children: kind === "in_call" ? /* @__PURE__ */ jsxRuntime.jsx(PhoneGlyph, {}) : kind === "dnd" ? /* @__PURE__ */ jsxRuntime.jsx(MoonGlyph, {}) : null
|
|
1799
|
+
}
|
|
1800
|
+
);
|
|
1801
|
+
}
|
|
1802
|
+
function presenceStateLabel(state) {
|
|
1803
|
+
switch (state) {
|
|
1804
|
+
case "online":
|
|
1805
|
+
return "Online";
|
|
1806
|
+
case "away":
|
|
1807
|
+
return "Away";
|
|
1808
|
+
case "in_call":
|
|
1809
|
+
return "In a call";
|
|
1810
|
+
default:
|
|
1811
|
+
return "Offline";
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
function presenceText(presence, now = Date.now()) {
|
|
1815
|
+
if (!presence) return null;
|
|
1816
|
+
if (presence.state === "offline") {
|
|
1817
|
+
const ago = formatRelativeTime(presence.last_seen_at, now);
|
|
1818
|
+
return ago ? `Last seen ${ago}` : "Offline";
|
|
1819
|
+
}
|
|
1820
|
+
return presenceStateLabel(presence.state);
|
|
1821
|
+
}
|
|
1822
|
+
function PhoneGlyph() {
|
|
1823
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1824
|
+
"path",
|
|
1825
|
+
{
|
|
1826
|
+
fill: "currentColor",
|
|
1827
|
+
d: "M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.25 1z"
|
|
1828
|
+
}
|
|
1829
|
+
) });
|
|
1830
|
+
}
|
|
1831
|
+
function MoonGlyph() {
|
|
1832
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "M20.5 14.6A8.6 8.6 0 0 1 9.4 3.5a8.6 8.6 0 1 0 11.1 11.1z" }) });
|
|
1833
|
+
}
|
|
1834
|
+
function Avatar({
|
|
1835
|
+
src,
|
|
1836
|
+
name,
|
|
1837
|
+
online,
|
|
1838
|
+
presence,
|
|
1839
|
+
userId,
|
|
1840
|
+
size = "md",
|
|
1841
|
+
className
|
|
1842
|
+
}) {
|
|
1843
|
+
const initials = computeInitials(name);
|
|
1844
|
+
const classes = ["poolse-avatar", size !== "md" ? `poolse-avatar--${size}` : null, className].filter(Boolean).join(" ");
|
|
1845
|
+
const badge = presence === true ? userId ? /* @__PURE__ */ jsxRuntime.jsx(LivePresenceBadge, { userId, size }) : null : presence ? typeof presence === "string" ? /* @__PURE__ */ jsxRuntime.jsx(PresenceBadge, { state: presence, size, className: "poolse-avatar__badge" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1846
|
+
PresenceBadge,
|
|
1847
|
+
{
|
|
1848
|
+
state: presence.state,
|
|
1849
|
+
doNotDisturb: !!presence.do_not_disturb,
|
|
1850
|
+
size,
|
|
1851
|
+
className: "poolse-avatar__badge"
|
|
1852
|
+
}
|
|
1853
|
+
) : online ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-avatar__presence", "aria-hidden": "true" }) : null;
|
|
1854
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classes, "aria-label": name ?? "avatar", role: "img", children: [
|
|
1855
|
+
src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name ?? "" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: initials }),
|
|
1856
|
+
badge
|
|
1857
|
+
] });
|
|
1858
|
+
}
|
|
1859
|
+
function LivePresenceBadge({ userId, size }) {
|
|
1860
|
+
const presence = react$1.useUserPresence(userId);
|
|
1861
|
+
if (!presence) return null;
|
|
1862
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1863
|
+
PresenceBadge,
|
|
1864
|
+
{
|
|
1865
|
+
state: presence.state,
|
|
1866
|
+
doNotDisturb: !!presence.do_not_disturb,
|
|
1867
|
+
...size ? { size } : {},
|
|
1868
|
+
className: "poolse-avatar__badge"
|
|
1869
|
+
}
|
|
1870
|
+
);
|
|
1871
|
+
}
|
|
1872
|
+
function computeInitials(name) {
|
|
1873
|
+
if (!name) return "?";
|
|
1874
|
+
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
1875
|
+
return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
|
|
1876
|
+
}
|
|
1877
|
+
var RECENT_KEY = "poolse:recent-emoji";
|
|
1878
|
+
var RECENT_MAX = 24;
|
|
1879
|
+
var SEARCH_MAX = 120;
|
|
1880
|
+
var COLUMNS = 8;
|
|
1881
|
+
var dataPromise = null;
|
|
1882
|
+
var loadedData = null;
|
|
1883
|
+
function loadEmojiData() {
|
|
1884
|
+
dataPromise ??= Promise.resolve().then(() => (init_emojiData(), emojiData_exports)).then((m) => {
|
|
1885
|
+
loadedData = m.EMOJI_CATEGORIES;
|
|
1886
|
+
return loadedData;
|
|
1887
|
+
});
|
|
1888
|
+
return dataPromise;
|
|
1889
|
+
}
|
|
1890
|
+
var recentMemory = null;
|
|
1891
|
+
function readRecent() {
|
|
1892
|
+
if (recentMemory) return recentMemory;
|
|
1893
|
+
try {
|
|
1894
|
+
const raw = globalThis.localStorage?.getItem(RECENT_KEY);
|
|
1895
|
+
const parsed = raw ? JSON.parse(raw) : [];
|
|
1896
|
+
recentMemory = Array.isArray(parsed) ? parsed.filter((e) => typeof e === "string").slice(0, RECENT_MAX) : [];
|
|
1897
|
+
} catch {
|
|
1898
|
+
recentMemory = [];
|
|
1899
|
+
}
|
|
1900
|
+
return recentMemory;
|
|
1901
|
+
}
|
|
1902
|
+
function rememberEmoji(emoji) {
|
|
1903
|
+
const next = [emoji, ...readRecent().filter((e) => e !== emoji)].slice(0, RECENT_MAX);
|
|
1904
|
+
recentMemory = next;
|
|
1905
|
+
try {
|
|
1906
|
+
globalThis.localStorage?.setItem(RECENT_KEY, JSON.stringify(next));
|
|
1907
|
+
} catch {
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
function EmojiPicker({ onPick, onClose, autoFocus = true, className }) {
|
|
1911
|
+
const [data, setData] = react.useState(loadedData);
|
|
1912
|
+
const [query, setQuery] = react.useState("");
|
|
1913
|
+
const [recent] = react.useState(readRecent);
|
|
1914
|
+
const rootRef = react.useRef(null);
|
|
1915
|
+
const searchRef = react.useRef(null);
|
|
1916
|
+
const gridRef = react.useRef(null);
|
|
1917
|
+
react.useEffect(() => {
|
|
1918
|
+
if (data) return;
|
|
1919
|
+
let live = true;
|
|
1920
|
+
void loadEmojiData().then((d) => {
|
|
1921
|
+
if (live) setData(d);
|
|
1922
|
+
});
|
|
1923
|
+
return () => {
|
|
1924
|
+
live = false;
|
|
1925
|
+
};
|
|
1926
|
+
}, [data]);
|
|
1927
|
+
react.useEffect(() => {
|
|
1928
|
+
if (autoFocus) searchRef.current?.focus();
|
|
1929
|
+
}, [autoFocus]);
|
|
1930
|
+
react.useEffect(() => {
|
|
1931
|
+
if (!onClose) return;
|
|
1932
|
+
const onPointer = (e) => {
|
|
1933
|
+
const t = e.target;
|
|
1934
|
+
if (t instanceof Node && rootRef.current && !rootRef.current.contains(t)) onClose();
|
|
1935
|
+
};
|
|
1936
|
+
document.addEventListener("pointerdown", onPointer, true);
|
|
1937
|
+
return () => document.removeEventListener("pointerdown", onPointer, true);
|
|
1938
|
+
}, [onClose]);
|
|
1939
|
+
const results = react.useMemo(() => {
|
|
1940
|
+
const q = query.trim().toLowerCase();
|
|
1941
|
+
if (!q || !data) return null;
|
|
1942
|
+
const words = q.split(/\s+/);
|
|
1943
|
+
const out = [];
|
|
1944
|
+
for (const cat of data) {
|
|
1945
|
+
for (const [emoji, keywords] of cat.emojis) {
|
|
1946
|
+
if (words.every((w) => keywords.includes(w))) out.push(emoji);
|
|
1947
|
+
if (out.length >= SEARCH_MAX) return out;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return out;
|
|
1951
|
+
}, [query, data]);
|
|
1952
|
+
const pick = (emoji) => {
|
|
1953
|
+
rememberEmoji(emoji);
|
|
1954
|
+
onPick(emoji);
|
|
1955
|
+
};
|
|
1956
|
+
const sections = data ? [
|
|
1957
|
+
...recent.length > 0 ? [{ id: "recent", label: "Recently used", emojis: recent }] : [],
|
|
1958
|
+
...data.map((c) => ({ id: c.id, label: c.label, emojis: c.emojis.map(([e]) => e) }))
|
|
1959
|
+
] : [];
|
|
1960
|
+
const jumpTo = (id) => {
|
|
1961
|
+
const el = gridRef.current?.querySelector(`[data-emoji-section="${id}"]`);
|
|
1962
|
+
if (el instanceof HTMLElement) {
|
|
1963
|
+
const grid = gridRef.current;
|
|
1964
|
+
grid.scrollTop = el.offsetTop - grid.offsetTop;
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
const onGridKey = (e) => {
|
|
1968
|
+
const keys = {
|
|
1969
|
+
ArrowRight: 1,
|
|
1970
|
+
ArrowLeft: -1,
|
|
1971
|
+
ArrowDown: COLUMNS,
|
|
1972
|
+
ArrowUp: -COLUMNS
|
|
1973
|
+
};
|
|
1974
|
+
const step = keys[e.key];
|
|
1975
|
+
if (step === void 0) return;
|
|
1976
|
+
const buttons = Array.from(
|
|
1977
|
+
gridRef.current?.querySelectorAll(".poolse-emoji-picker__emoji") ?? []
|
|
1978
|
+
);
|
|
1979
|
+
const idx = buttons.findIndex((b) => b === document.activeElement);
|
|
1980
|
+
if (idx === -1) return;
|
|
1981
|
+
const next = buttons[idx + step];
|
|
1982
|
+
if (next) {
|
|
1983
|
+
next.focus();
|
|
1984
|
+
e.preventDefault();
|
|
1985
|
+
} else if (step < 0) {
|
|
1986
|
+
searchRef.current?.focus();
|
|
1987
|
+
e.preventDefault();
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
const onRootKey = (e) => {
|
|
1991
|
+
if (e.key === "Escape") {
|
|
1992
|
+
e.stopPropagation();
|
|
1993
|
+
e.preventDefault();
|
|
1994
|
+
onClose?.();
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
const emojiButton = (emoji, key) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
+
"button",
|
|
1999
|
+
{
|
|
2000
|
+
type: "button",
|
|
2001
|
+
className: "poolse-emoji-picker__emoji",
|
|
2002
|
+
onClick: () => pick(emoji),
|
|
2003
|
+
"aria-label": emoji,
|
|
2004
|
+
children: emoji
|
|
2005
|
+
},
|
|
2006
|
+
key
|
|
2007
|
+
);
|
|
2008
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2009
|
+
"div",
|
|
2010
|
+
{
|
|
2011
|
+
ref: rootRef,
|
|
2012
|
+
className: ["poolse-emoji-picker", className].filter(Boolean).join(" "),
|
|
2013
|
+
role: "dialog",
|
|
2014
|
+
"aria-label": "Emoji picker",
|
|
2015
|
+
onKeyDown: onRootKey,
|
|
2016
|
+
children: [
|
|
2017
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2018
|
+
"input",
|
|
2019
|
+
{
|
|
2020
|
+
ref: searchRef,
|
|
2021
|
+
type: "search",
|
|
2022
|
+
className: "poolse-emoji-picker__search",
|
|
2023
|
+
placeholder: "Search emoji",
|
|
2024
|
+
"aria-label": "Search emoji",
|
|
2025
|
+
value: query,
|
|
2026
|
+
onChange: (e) => setQuery(e.target.value),
|
|
2027
|
+
onKeyDown: (e) => {
|
|
2028
|
+
if (e.key === "Enter") {
|
|
2029
|
+
e.preventDefault();
|
|
2030
|
+
const first = results?.[0];
|
|
2031
|
+
if (first) pick(first);
|
|
2032
|
+
}
|
|
2033
|
+
if (e.key === "ArrowDown") {
|
|
2034
|
+
e.preventDefault();
|
|
2035
|
+
gridRef.current?.querySelector(".poolse-emoji-picker__emoji")?.focus();
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
),
|
|
2040
|
+
!results && data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__tabs", role: "toolbar", "aria-label": "Emoji categories", children: sections.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2041
|
+
"button",
|
|
2042
|
+
{
|
|
2043
|
+
type: "button",
|
|
2044
|
+
className: "poolse-emoji-picker__tab",
|
|
2045
|
+
"aria-label": s.label,
|
|
2046
|
+
title: s.label,
|
|
2047
|
+
onClick: () => jumpTo(s.id),
|
|
2048
|
+
children: s.id === "recent" ? "\u{1F558}" : s.emojis[0]
|
|
2049
|
+
},
|
|
2050
|
+
s.id
|
|
2051
|
+
)) }) : null,
|
|
2052
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: gridRef, className: "poolse-emoji-picker__scroll", onKeyDown: onGridKey, children: !data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__empty", children: "Loading\u2026" }) : results ? results.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__empty", children: "No emoji found" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__grid", role: "group", "aria-label": "Search results", children: results.map((e, i) => emojiButton(e, `${i}-${e}`)) }) : sections.map((s) => /* @__PURE__ */ jsxRuntime.jsxs("section", { "data-emoji-section": s.id, "aria-label": s.label, children: [
|
|
2053
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__heading", children: s.label }),
|
|
2054
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__grid", children: s.emojis.map((e, i) => emojiButton(e, `${s.id}-${i}`)) })
|
|
2055
|
+
] }, s.id)) })
|
|
2056
|
+
]
|
|
2057
|
+
}
|
|
2058
|
+
);
|
|
2059
|
+
}
|
|
2060
|
+
function ComposerEmojiButton({
|
|
2061
|
+
disabled,
|
|
2062
|
+
onPick
|
|
2063
|
+
}) {
|
|
2064
|
+
const [open, setOpen] = react.useState(false);
|
|
2065
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__emoji", children: [
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2067
|
+
"button",
|
|
2068
|
+
{
|
|
2069
|
+
type: "button",
|
|
2070
|
+
className: "poolse-composer__attach poolse-composer__emoji-btn",
|
|
2071
|
+
onClick: () => setOpen((o) => !o),
|
|
2072
|
+
onPointerEnter: () => void loadEmojiData(),
|
|
2073
|
+
disabled,
|
|
2074
|
+
"aria-label": "Insert emoji",
|
|
2075
|
+
"aria-expanded": open,
|
|
2076
|
+
title: "Insert emoji",
|
|
2077
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "emoji", size: 20, label: null })
|
|
2078
|
+
}
|
|
2079
|
+
),
|
|
2080
|
+
open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-composer__emoji-popover", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2081
|
+
EmojiPicker,
|
|
2082
|
+
{
|
|
2083
|
+
onPick: (emoji) => {
|
|
2084
|
+
setOpen(false);
|
|
2085
|
+
onPick(emoji);
|
|
2086
|
+
},
|
|
2087
|
+
onClose: () => setOpen(false)
|
|
2088
|
+
}
|
|
2089
|
+
) })
|
|
2090
|
+
] });
|
|
2091
|
+
}
|
|
2092
|
+
function insertAtCaret(value, text, ta) {
|
|
2093
|
+
const el = ta.current;
|
|
2094
|
+
const start = el?.selectionStart ?? value.length;
|
|
2095
|
+
const end = el?.selectionEnd ?? value.length;
|
|
2096
|
+
const next = value.slice(0, start) + text + value.slice(end);
|
|
2097
|
+
const caret = start + text.length;
|
|
2098
|
+
requestAnimationFrame(() => {
|
|
2099
|
+
const t = ta.current;
|
|
2100
|
+
if (!t) return;
|
|
2101
|
+
t.focus();
|
|
2102
|
+
t.setSelectionRange(caret, caret);
|
|
2103
|
+
});
|
|
2104
|
+
return next;
|
|
2105
|
+
}
|
|
2106
|
+
function attachmentProblem(file, rules) {
|
|
2107
|
+
if (rules.maxFileSize !== void 0 && file.size > rules.maxFileSize) {
|
|
2108
|
+
return `Larger than ${formatBytes(rules.maxFileSize)}`;
|
|
2109
|
+
}
|
|
2110
|
+
const accept = rules.acceptFileTypes;
|
|
2111
|
+
if (accept && accept.length > 0 && !accept.some((rule) => matchesType(file, rule))) {
|
|
2112
|
+
return "This file type isn't allowed";
|
|
2113
|
+
}
|
|
2114
|
+
return null;
|
|
2115
|
+
}
|
|
2116
|
+
function matchesType(file, rule) {
|
|
2117
|
+
const r = rule.trim().toLowerCase();
|
|
2118
|
+
if (!r) return false;
|
|
2119
|
+
if (r.startsWith(".")) return file.name.toLowerCase().endsWith(r);
|
|
2120
|
+
const type = (file.type || "").toLowerCase();
|
|
2121
|
+
if (r.endsWith("/*")) return type.startsWith(r.slice(0, -1));
|
|
2122
|
+
return type === r;
|
|
2123
|
+
}
|
|
2124
|
+
function formatBytes(n) {
|
|
2125
|
+
if (n >= 1024 * 1024 * 1024) return `${trim(n / (1024 * 1024 * 1024))} GB`;
|
|
2126
|
+
if (n >= 1024 * 1024) return `${trim(n / (1024 * 1024))} MB`;
|
|
2127
|
+
if (n >= 1024) return `${trim(n / 1024)} KB`;
|
|
2128
|
+
return `${n} B`;
|
|
2129
|
+
}
|
|
2130
|
+
function trim(x) {
|
|
2131
|
+
return x >= 10 ? String(Math.round(x)) : String(Math.round(x * 10) / 10);
|
|
2132
|
+
}
|
|
2133
|
+
var fileKey = (name, size, type) => `${name}\0${size}\0${type}`;
|
|
2134
|
+
function useComposerAttachments(enabled, rules) {
|
|
2135
|
+
const { queue, uploadAll, cancel, remove } = react$1.useAttachmentUpload();
|
|
2136
|
+
const [rejected, setRejected] = react.useState([]);
|
|
2137
|
+
const thumbs = react.useRef(/* @__PURE__ */ new Map());
|
|
2138
|
+
react.useEffect(() => {
|
|
2139
|
+
const map = thumbs.current;
|
|
2140
|
+
return () => {
|
|
2141
|
+
for (const url of map.values()) URL.revokeObjectURL?.(url);
|
|
2142
|
+
map.clear();
|
|
2143
|
+
};
|
|
2144
|
+
}, []);
|
|
2145
|
+
const rulesRef = react.useRef(rules);
|
|
2146
|
+
rulesRef.current = rules;
|
|
2147
|
+
const addFiles = react.useCallback(
|
|
2148
|
+
(files) => {
|
|
2149
|
+
if (!enabled || files.length === 0) return;
|
|
2150
|
+
const ok = [];
|
|
2151
|
+
const refused = [];
|
|
2152
|
+
for (const f of files) {
|
|
2153
|
+
const problem = attachmentProblem(f, rulesRef.current);
|
|
2154
|
+
if (problem) {
|
|
2155
|
+
refused.push({
|
|
2156
|
+
localId: `rejected-${Math.random().toString(36).slice(2)}`,
|
|
2157
|
+
filename: f.name,
|
|
2158
|
+
contentType: f.type || "application/octet-stream",
|
|
2159
|
+
byteSize: f.size,
|
|
2160
|
+
status: "error",
|
|
2161
|
+
loaded: 0,
|
|
2162
|
+
attachment: null,
|
|
2163
|
+
error: new Error(problem)
|
|
2164
|
+
});
|
|
2165
|
+
continue;
|
|
2166
|
+
}
|
|
2167
|
+
ok.push(f);
|
|
2168
|
+
if (f.type.startsWith("image/") && typeof URL.createObjectURL === "function") {
|
|
2169
|
+
const key = fileKey(f.name, f.size, f.type);
|
|
2170
|
+
if (!thumbs.current.has(key)) thumbs.current.set(key, URL.createObjectURL(f));
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
if (refused.length > 0) setRejected((prev) => [...prev, ...refused]);
|
|
2174
|
+
if (ok.length === 0) return;
|
|
2175
|
+
void uploadAll(
|
|
2176
|
+
ok.map((f) => ({
|
|
2177
|
+
body: f,
|
|
2178
|
+
contentType: f.type || "application/octet-stream",
|
|
2179
|
+
byteSize: f.size,
|
|
2180
|
+
filename: f.name
|
|
2181
|
+
}))
|
|
2182
|
+
).catch(() => {
|
|
2183
|
+
});
|
|
2184
|
+
},
|
|
2185
|
+
[enabled, uploadAll]
|
|
2186
|
+
);
|
|
2187
|
+
const dismiss = react.useCallback(
|
|
2188
|
+
(localId) => {
|
|
2189
|
+
if (localId.startsWith("rejected-")) {
|
|
2190
|
+
setRejected((prev) => prev.filter((it) => it.localId !== localId));
|
|
2191
|
+
} else {
|
|
2192
|
+
remove(localId);
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
[remove]
|
|
2196
|
+
);
|
|
2197
|
+
const previewFor = react.useCallback(
|
|
2198
|
+
(item) => thumbs.current.get(fileKey(item.filename, item.byteSize, item.contentType)) ?? null,
|
|
2199
|
+
[]
|
|
2200
|
+
);
|
|
2201
|
+
const onPaste = react.useCallback(
|
|
2202
|
+
(e) => {
|
|
2203
|
+
if (!enabled) return;
|
|
2204
|
+
const files = Array.from(e.clipboardData?.files ?? []);
|
|
2205
|
+
if (files.length === 0) return;
|
|
2206
|
+
e.preventDefault();
|
|
2207
|
+
addFiles(files);
|
|
2208
|
+
},
|
|
2209
|
+
[enabled, addFiles]
|
|
2210
|
+
);
|
|
2211
|
+
const live = queue.filter((it) => it.status !== "cancelled");
|
|
2212
|
+
return {
|
|
2213
|
+
queue,
|
|
2214
|
+
/** Every chip to show: staged uploads, then files refused before upload. */
|
|
2215
|
+
items: [...live, ...rejected],
|
|
2216
|
+
ready: queue.filter((it) => it.status === "ready"),
|
|
2217
|
+
uploading: queue.some((it) => it.status === "pending" || it.status === "uploading"),
|
|
2218
|
+
addFiles,
|
|
2219
|
+
cancel,
|
|
2220
|
+
/** Remove a chip (an upload or a refused file). */
|
|
2221
|
+
dismiss,
|
|
2222
|
+
remove,
|
|
2223
|
+
/** Clear the refused-file chips (after a send). */
|
|
2224
|
+
clearRejected: () => setRejected([]),
|
|
2225
|
+
previewFor,
|
|
2226
|
+
onPaste,
|
|
2227
|
+
/** For the file input's `accept`. */
|
|
2228
|
+
accept: rules.acceptFileTypes?.join(",") || void 0
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
800
2231
|
|
|
801
2232
|
// src/listAutocomplete.ts
|
|
802
2233
|
var UNORDERED_RE = /^(\s*)([-*+]) (.*)$/;
|
|
@@ -831,12 +2262,18 @@ ${indent}${nextMarker} `;
|
|
|
831
2262
|
caret: caret + prefix.length
|
|
832
2263
|
};
|
|
833
2264
|
}
|
|
834
|
-
function UploadQueueStrip({
|
|
2265
|
+
function UploadQueueStrip({
|
|
2266
|
+
items,
|
|
2267
|
+
onCancel,
|
|
2268
|
+
onDismiss,
|
|
2269
|
+
previewFor
|
|
2270
|
+
}) {
|
|
835
2271
|
if (items.length === 0) return null;
|
|
836
2272
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-strip", role: "status", "aria-live": "polite", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
837
2273
|
UploadChip,
|
|
838
2274
|
{
|
|
839
2275
|
item,
|
|
2276
|
+
thumbnail: previewFor?.(item) ?? null,
|
|
840
2277
|
onCancel: () => onCancel(item.localId),
|
|
841
2278
|
onDismiss: () => onDismiss(item.localId)
|
|
842
2279
|
},
|
|
@@ -845,6 +2282,7 @@ function UploadQueueStrip({ items, onCancel, onDismiss }) {
|
|
|
845
2282
|
}
|
|
846
2283
|
function UploadChip({
|
|
847
2284
|
item,
|
|
2285
|
+
thumbnail,
|
|
848
2286
|
onCancel,
|
|
849
2287
|
onDismiss
|
|
850
2288
|
}) {
|
|
@@ -858,7 +2296,7 @@ function UploadChip({
|
|
|
858
2296
|
className: `poolse-upload-chip poolse-upload-chip--${item.status}`,
|
|
859
2297
|
"data-status": item.status,
|
|
860
2298
|
children: [
|
|
861
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: isReady ? "check" : "attachment", size: 18, label: null }) }),
|
|
2299
|
+
thumbnail && !isError ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "poolse-upload-chip__thumb", src: thumbnail, alt: "", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: isReady ? "check" : "attachment", size: 18, label: null }) }),
|
|
862
2300
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-upload-chip__body", children: [
|
|
863
2301
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__filename", title: item.filename, children: item.filename }),
|
|
864
2302
|
isError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__error", children: item.error?.message ?? "Upload failed" }) : isReady ? (
|
|
@@ -894,31 +2332,6 @@ function UploadChip({
|
|
|
894
2332
|
}
|
|
895
2333
|
);
|
|
896
2334
|
}
|
|
897
|
-
var MAX_NAME_CHARS = 24;
|
|
898
|
-
function UserName({
|
|
899
|
-
externalId,
|
|
900
|
-
labelFor,
|
|
901
|
-
emptyFallback = "Unknown",
|
|
902
|
-
className
|
|
903
|
-
}) {
|
|
904
|
-
const { profile } = react$1.useUser(labelFor ? null : externalId);
|
|
905
|
-
const name = resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
|
|
906
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: truncate(name) });
|
|
907
|
-
}
|
|
908
|
-
function useDisplayName(externalId, labelFor, emptyFallback = "Unknown") {
|
|
909
|
-
const { profile } = react$1.useUser(labelFor ? null : externalId);
|
|
910
|
-
return resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
|
|
911
|
-
}
|
|
912
|
-
function resolveDisplayName(externalId, resolved, labelFor, emptyFallback) {
|
|
913
|
-
if (!externalId) return emptyFallback;
|
|
914
|
-
if (labelFor) return labelFor(externalId);
|
|
915
|
-
if (resolved) return resolved;
|
|
916
|
-
return externalId;
|
|
917
|
-
}
|
|
918
|
-
function truncate(s) {
|
|
919
|
-
if (s.length <= MAX_NAME_CHARS) return s;
|
|
920
|
-
return s.slice(0, MAX_NAME_CHARS - 1) + "\u2026";
|
|
921
|
-
}
|
|
922
2335
|
function useAutogrow(ref, value) {
|
|
923
2336
|
react.useEffect(() => {
|
|
924
2337
|
const ta = ref.current;
|
|
@@ -927,6 +2340,7 @@ function useAutogrow(ref, value) {
|
|
|
927
2340
|
ta.style.height = `${ta.scrollHeight}px`;
|
|
928
2341
|
}, [ref, value]);
|
|
929
2342
|
}
|
|
2343
|
+
var MAX_SUGGESTIONS = 8;
|
|
930
2344
|
var MentionInput = react.forwardRef(
|
|
931
2345
|
function MentionInput2({
|
|
932
2346
|
conversationId,
|
|
@@ -937,52 +2351,83 @@ var MentionInput = react.forwardRef(
|
|
|
937
2351
|
labelFor,
|
|
938
2352
|
replyingTo,
|
|
939
2353
|
onCancelReply,
|
|
940
|
-
attachments = true
|
|
2354
|
+
attachments = true,
|
|
2355
|
+
emojiPicker = true,
|
|
2356
|
+
maxFileSize,
|
|
2357
|
+
acceptFileTypes,
|
|
2358
|
+
onValueChange
|
|
941
2359
|
}, ref) {
|
|
2360
|
+
const chat = react$1.usePoolse();
|
|
942
2361
|
const { members } = react$1.useMembers(conversationId);
|
|
943
2362
|
const [value, setValue] = react.useState("");
|
|
944
2363
|
const [sending, setSending] = react.useState(false);
|
|
945
2364
|
const [mention, setMention] = react.useState(null);
|
|
946
2365
|
const [activeIdx, setActiveIdx] = react.useState(0);
|
|
947
|
-
const
|
|
2366
|
+
const menuId = react.useId();
|
|
2367
|
+
const [, bumpProfiles] = react.useReducer((n) => n + 1, 0);
|
|
2368
|
+
const selectedMentions = react.useRef(/* @__PURE__ */ new Map());
|
|
948
2369
|
const taRef = react.useRef(null);
|
|
949
2370
|
const fileInputRef = react.useRef(null);
|
|
950
2371
|
useAutogrow(taRef, value);
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const addFiles =
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
2372
|
+
const uploads = useComposerAttachments(attachments, {
|
|
2373
|
+
...maxFileSize !== void 0 ? { maxFileSize } : {},
|
|
2374
|
+
...acceptFileTypes ? { acceptFileTypes } : {}
|
|
2375
|
+
});
|
|
2376
|
+
const { addFiles, uploading } = uploads;
|
|
2377
|
+
const visibleUploads = uploads.items;
|
|
2378
|
+
const readyCount = uploads.ready.length;
|
|
2379
|
+
const valueRef = react.useRef(value);
|
|
2380
|
+
valueRef.current = value;
|
|
2381
|
+
const onValueChangeRef = react.useRef(onValueChange);
|
|
2382
|
+
onValueChangeRef.current = onValueChange;
|
|
2383
|
+
const reportedRef = react.useRef(value);
|
|
2384
|
+
react.useEffect(() => {
|
|
2385
|
+
if (reportedRef.current === value) return;
|
|
2386
|
+
reportedRef.current = value;
|
|
2387
|
+
onValueChangeRef.current?.(value);
|
|
2388
|
+
}, [value]);
|
|
2389
|
+
react.useImperativeHandle(
|
|
2390
|
+
ref,
|
|
2391
|
+
() => ({
|
|
2392
|
+
addFiles,
|
|
2393
|
+
getText: () => valueRef.current,
|
|
2394
|
+
setText: (text) => setValue(text),
|
|
2395
|
+
focus: () => taRef.current?.focus()
|
|
2396
|
+
}),
|
|
2397
|
+
[addFiles]
|
|
969
2398
|
);
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
|
|
2399
|
+
const label = (id) => labelFor?.(id) ?? chat.users.peek(id)?.displayName ?? id;
|
|
2400
|
+
const meId = chat.me.peek()?.id ?? null;
|
|
2401
|
+
const menuOpen = mention !== null;
|
|
2402
|
+
react.useEffect(() => {
|
|
2403
|
+
if (!menuOpen || labelFor) return;
|
|
2404
|
+
let live = true;
|
|
2405
|
+
for (const m of members) {
|
|
2406
|
+
if (chat.users.peek(m.external_id) !== void 0) continue;
|
|
2407
|
+
void chat.users.get(m.external_id).then(() => {
|
|
2408
|
+
if (live) bumpProfiles();
|
|
2409
|
+
}).catch(() => void 0);
|
|
2410
|
+
}
|
|
2411
|
+
return () => {
|
|
2412
|
+
live = false;
|
|
2413
|
+
};
|
|
2414
|
+
}, [menuOpen, members, chat, labelFor]);
|
|
2415
|
+
const filtered = mention ? rankMembers(
|
|
2416
|
+
members.filter((m) => m.user_id !== meId),
|
|
2417
|
+
mention.query.toLowerCase(),
|
|
2418
|
+
label
|
|
2419
|
+
).slice(0, MAX_SUGGESTIONS) : [];
|
|
975
2420
|
react.useEffect(() => {
|
|
976
2421
|
setActiveIdx(0);
|
|
977
2422
|
}, [filtered.length, mention?.query]);
|
|
978
2423
|
const submit = async () => {
|
|
979
2424
|
const trimmed = value.trim();
|
|
980
|
-
const ready =
|
|
2425
|
+
const ready = uploads.ready;
|
|
981
2426
|
const hasReady = ready.length > 0;
|
|
982
2427
|
if (!trimmed && !hasReady || sending || uploading) return;
|
|
983
2428
|
setSending(true);
|
|
984
2429
|
try {
|
|
985
|
-
const mentions =
|
|
2430
|
+
const mentions = [...selectedMentions.current].filter(([, name]) => trimmed.includes(`@${name}`)).map(([id]) => id);
|
|
986
2431
|
await onSend({
|
|
987
2432
|
body: trimmed,
|
|
988
2433
|
...mentions.length > 0 ? { mentions } : {},
|
|
@@ -990,8 +2435,9 @@ var MentionInput = react.forwardRef(
|
|
|
990
2435
|
...hasReady ? { attachment_ids: ready.map((it) => it.attachment.id) } : {}
|
|
991
2436
|
});
|
|
992
2437
|
setValue("");
|
|
993
|
-
selectedMentions.current = /* @__PURE__ */ new
|
|
994
|
-
for (const it of ready)
|
|
2438
|
+
selectedMentions.current = /* @__PURE__ */ new Map();
|
|
2439
|
+
for (const it of ready) uploads.remove(it.localId);
|
|
2440
|
+
uploads.clearRejected();
|
|
995
2441
|
} finally {
|
|
996
2442
|
setSending(false);
|
|
997
2443
|
}
|
|
@@ -1003,7 +2449,7 @@ var MentionInput = react.forwardRef(
|
|
|
1003
2449
|
const after = value.slice(mention.start + 1 + mention.query.length);
|
|
1004
2450
|
const inserted = `@${name} `;
|
|
1005
2451
|
const next = `${before}${inserted}${after}`;
|
|
1006
|
-
selectedMentions.current.
|
|
2452
|
+
selectedMentions.current.set(m.user_id, name);
|
|
1007
2453
|
setValue(next);
|
|
1008
2454
|
setMention(null);
|
|
1009
2455
|
requestAnimationFrame(() => {
|
|
@@ -1116,8 +2562,9 @@ var MentionInput = react.forwardRef(
|
|
|
1116
2562
|
UploadQueueStrip,
|
|
1117
2563
|
{
|
|
1118
2564
|
items: visibleUploads,
|
|
1119
|
-
onCancel:
|
|
1120
|
-
onDismiss:
|
|
2565
|
+
onCancel: uploads.cancel,
|
|
2566
|
+
onDismiss: uploads.dismiss,
|
|
2567
|
+
previewFor: uploads.previewFor
|
|
1121
2568
|
}
|
|
1122
2569
|
),
|
|
1123
2570
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__row", children: [
|
|
@@ -1128,6 +2575,7 @@ var MentionInput = react.forwardRef(
|
|
|
1128
2575
|
ref: fileInputRef,
|
|
1129
2576
|
type: "file",
|
|
1130
2577
|
multiple: true,
|
|
2578
|
+
...uploads.accept ? { accept: uploads.accept } : {},
|
|
1131
2579
|
className: "poolse-attach-input",
|
|
1132
2580
|
onChange: (e) => {
|
|
1133
2581
|
const files = Array.from(e.target.files ?? []);
|
|
@@ -1158,14 +2606,22 @@ var MentionInput = react.forwardRef(
|
|
|
1158
2606
|
value,
|
|
1159
2607
|
onChange,
|
|
1160
2608
|
onKeyDown,
|
|
2609
|
+
onPaste: uploads.onPaste,
|
|
1161
2610
|
placeholder,
|
|
1162
2611
|
disabled: disabled || sending,
|
|
1163
2612
|
"aria-label": placeholder,
|
|
1164
2613
|
role: "combobox",
|
|
1165
2614
|
"aria-expanded": Boolean(mention && filtered.length > 0),
|
|
1166
|
-
"aria-controls":
|
|
2615
|
+
"aria-controls": menuId,
|
|
1167
2616
|
"aria-autocomplete": "list",
|
|
1168
|
-
...mention && filtered.length > 0 ? { "aria-activedescendant":
|
|
2617
|
+
...mention && filtered.length > 0 ? { "aria-activedescendant": `${menuId}-opt-${activeIdx}` } : {}
|
|
2618
|
+
}
|
|
2619
|
+
),
|
|
2620
|
+
emojiPicker && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2621
|
+
ComposerEmojiButton,
|
|
2622
|
+
{
|
|
2623
|
+
disabled: disabled || sending,
|
|
2624
|
+
onPick: (emoji) => setValue((v) => insertAtCaret(v, emoji, taRef))
|
|
1169
2625
|
}
|
|
1170
2626
|
),
|
|
1171
2627
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1180,38 +2636,46 @@ var MentionInput = react.forwardRef(
|
|
|
1180
2636
|
}
|
|
1181
2637
|
)
|
|
1182
2638
|
] }),
|
|
1183
|
-
mention && filtered.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2639
|
+
mention && filtered.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { id: menuId, className: "poolse-mention-menu", role: "listbox", "aria-label": "Members", children: filtered.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1184
2640
|
"div",
|
|
1185
2641
|
{
|
|
1186
|
-
id:
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
"
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
insertMention(m);
|
|
1200
|
-
},
|
|
1201
|
-
children: [
|
|
1202
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "@" }),
|
|
1203
|
-
/* @__PURE__ */ jsxRuntime.jsx(UserName, { externalId: m.external_id, ...labelFor ? { labelFor } : {} })
|
|
1204
|
-
]
|
|
1205
|
-
},
|
|
1206
|
-
m.id
|
|
1207
|
-
))
|
|
1208
|
-
}
|
|
1209
|
-
)
|
|
2642
|
+
id: `${menuId}-opt-${i}`,
|
|
2643
|
+
role: "option",
|
|
2644
|
+
"aria-selected": i === activeIdx,
|
|
2645
|
+
className: `poolse-mention-menu__item${i === activeIdx ? " poolse-mention-menu__item--active" : ""}`,
|
|
2646
|
+
onMouseEnter: () => setActiveIdx(i),
|
|
2647
|
+
onMouseDown: (e) => {
|
|
2648
|
+
e.preventDefault();
|
|
2649
|
+
insertMention(m);
|
|
2650
|
+
},
|
|
2651
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MentionOption, { member: m, name: label(m.external_id) })
|
|
2652
|
+
},
|
|
2653
|
+
m.id
|
|
2654
|
+
)) })
|
|
1210
2655
|
]
|
|
1211
2656
|
}
|
|
1212
2657
|
);
|
|
1213
2658
|
}
|
|
1214
2659
|
);
|
|
2660
|
+
function MentionOption({ member, name }) {
|
|
2661
|
+
const { profile } = react$1.useUser(member.external_id);
|
|
2662
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: profile?.avatarUrl ?? null, name, size: "xs" }),
|
|
2664
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-mention-menu__name", children: name }),
|
|
2665
|
+
name !== member.external_id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-mention-menu__handle", children: member.external_id }) : null
|
|
2666
|
+
] });
|
|
2667
|
+
}
|
|
2668
|
+
function rankMembers(members, query, label) {
|
|
2669
|
+
const scored = [];
|
|
2670
|
+
for (const m of members) {
|
|
2671
|
+
const name = label(m.external_id).toLowerCase();
|
|
2672
|
+
const ext = m.external_id.toLowerCase();
|
|
2673
|
+
const score = query === "" ? 1 : name.startsWith(query) ? 3 : name.split(/\s+/).some((w) => w.startsWith(query)) ? 2 : name.includes(query) || ext.includes(query) ? 1 : 0;
|
|
2674
|
+
if (score > 0) scored.push({ m, score, name });
|
|
2675
|
+
}
|
|
2676
|
+
scored.sort((a, b) => b.score - a.score || a.name.localeCompare(b.name));
|
|
2677
|
+
return scored.map((s) => s.m);
|
|
2678
|
+
}
|
|
1215
2679
|
var MessageComposer = react.forwardRef(
|
|
1216
2680
|
function MessageComposer2({
|
|
1217
2681
|
onSend,
|
|
@@ -1221,36 +2685,47 @@ var MessageComposer = react.forwardRef(
|
|
|
1221
2685
|
replyingTo,
|
|
1222
2686
|
onCancelReply,
|
|
1223
2687
|
labelFor,
|
|
1224
|
-
attachments = true
|
|
2688
|
+
attachments = true,
|
|
2689
|
+
emojiPicker = true,
|
|
2690
|
+
maxFileSize,
|
|
2691
|
+
acceptFileTypes,
|
|
2692
|
+
onValueChange
|
|
1225
2693
|
}, ref) {
|
|
1226
2694
|
const [value, setValue] = react.useState("");
|
|
1227
2695
|
const [sending, setSending] = react.useState(false);
|
|
1228
2696
|
const taRef = react.useRef(null);
|
|
1229
2697
|
const fileInputRef = react.useRef(null);
|
|
1230
2698
|
useAutogrow(taRef, value);
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
const addFiles =
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
2699
|
+
const uploads = useComposerAttachments(attachments, {
|
|
2700
|
+
...maxFileSize !== void 0 ? { maxFileSize } : {},
|
|
2701
|
+
...acceptFileTypes ? { acceptFileTypes } : {}
|
|
2702
|
+
});
|
|
2703
|
+
const { addFiles, uploading } = uploads;
|
|
2704
|
+
const visibleUploads = uploads.items;
|
|
2705
|
+
const readyCount = uploads.ready.length;
|
|
2706
|
+
const valueRef = react.useRef(value);
|
|
2707
|
+
valueRef.current = value;
|
|
2708
|
+
const onValueChangeRef = react.useRef(onValueChange);
|
|
2709
|
+
onValueChangeRef.current = onValueChange;
|
|
2710
|
+
const reportedRef = react.useRef(value);
|
|
2711
|
+
react.useEffect(() => {
|
|
2712
|
+
if (reportedRef.current === value) return;
|
|
2713
|
+
reportedRef.current = value;
|
|
2714
|
+
onValueChangeRef.current?.(value);
|
|
2715
|
+
}, [value]);
|
|
2716
|
+
react.useImperativeHandle(
|
|
2717
|
+
ref,
|
|
2718
|
+
() => ({
|
|
2719
|
+
addFiles,
|
|
2720
|
+
getText: () => valueRef.current,
|
|
2721
|
+
setText: (text) => setValue(text),
|
|
2722
|
+
focus: () => taRef.current?.focus()
|
|
2723
|
+
}),
|
|
2724
|
+
[addFiles]
|
|
1249
2725
|
);
|
|
1250
|
-
react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles]);
|
|
1251
2726
|
const submit = async () => {
|
|
1252
2727
|
const trimmed = value.trim();
|
|
1253
|
-
const ready =
|
|
2728
|
+
const ready = uploads.ready;
|
|
1254
2729
|
const hasReady = ready.length > 0;
|
|
1255
2730
|
if (!trimmed && !hasReady || sending || uploading) return;
|
|
1256
2731
|
const opts = {
|
|
@@ -1258,7 +2733,8 @@ var MessageComposer = react.forwardRef(
|
|
|
1258
2733
|
...hasReady ? { attachment_ids: ready.map((it) => it.attachment.id) } : {}
|
|
1259
2734
|
};
|
|
1260
2735
|
setValue("");
|
|
1261
|
-
for (const it of ready)
|
|
2736
|
+
for (const it of ready) uploads.remove(it.localId);
|
|
2737
|
+
uploads.clearRejected();
|
|
1262
2738
|
setSending(true);
|
|
1263
2739
|
try {
|
|
1264
2740
|
await onSend(trimmed, Object.keys(opts).length > 0 ? opts : void 0);
|
|
@@ -1313,8 +2789,9 @@ var MessageComposer = react.forwardRef(
|
|
|
1313
2789
|
UploadQueueStrip,
|
|
1314
2790
|
{
|
|
1315
2791
|
items: visibleUploads,
|
|
1316
|
-
onCancel:
|
|
1317
|
-
onDismiss:
|
|
2792
|
+
onCancel: uploads.cancel,
|
|
2793
|
+
onDismiss: uploads.dismiss,
|
|
2794
|
+
previewFor: uploads.previewFor
|
|
1318
2795
|
}
|
|
1319
2796
|
),
|
|
1320
2797
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__row", children: [
|
|
@@ -1325,6 +2802,7 @@ var MessageComposer = react.forwardRef(
|
|
|
1325
2802
|
ref: fileInputRef,
|
|
1326
2803
|
type: "file",
|
|
1327
2804
|
multiple: true,
|
|
2805
|
+
...uploads.accept ? { accept: uploads.accept } : {},
|
|
1328
2806
|
className: "poolse-attach-input",
|
|
1329
2807
|
onChange: (e) => {
|
|
1330
2808
|
const files = Array.from(e.target.files ?? []);
|
|
@@ -1355,11 +2833,19 @@ var MessageComposer = react.forwardRef(
|
|
|
1355
2833
|
value,
|
|
1356
2834
|
onChange,
|
|
1357
2835
|
onKeyDown,
|
|
2836
|
+
onPaste: uploads.onPaste,
|
|
1358
2837
|
placeholder,
|
|
1359
2838
|
disabled: disabled || sending,
|
|
1360
2839
|
"aria-label": placeholder
|
|
1361
2840
|
}
|
|
1362
2841
|
),
|
|
2842
|
+
emojiPicker && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2843
|
+
ComposerEmojiButton,
|
|
2844
|
+
{
|
|
2845
|
+
disabled: disabled || sending,
|
|
2846
|
+
onPick: (emoji) => setValue((v) => insertAtCaret(v, emoji, taRef))
|
|
2847
|
+
}
|
|
2848
|
+
),
|
|
1363
2849
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1364
2850
|
"button",
|
|
1365
2851
|
{
|
|
@@ -1405,24 +2891,6 @@ function ReplyChip({
|
|
|
1405
2891
|
)
|
|
1406
2892
|
] });
|
|
1407
2893
|
}
|
|
1408
|
-
function Avatar({ src, name, online, size = "md", className }) {
|
|
1409
|
-
const initials = computeInitials(name);
|
|
1410
|
-
const classes = [
|
|
1411
|
-
"poolse-avatar",
|
|
1412
|
-
size === "sm" ? "poolse-avatar--sm" : null,
|
|
1413
|
-
size === "lg" ? "poolse-avatar--lg" : null,
|
|
1414
|
-
className
|
|
1415
|
-
].filter(Boolean).join(" ");
|
|
1416
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classes, "aria-label": name ?? "avatar", role: "img", children: [
|
|
1417
|
-
src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name ?? "" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: initials }),
|
|
1418
|
-
online ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-avatar__presence", "aria-hidden": "true" }) : null
|
|
1419
|
-
] });
|
|
1420
|
-
}
|
|
1421
|
-
function computeInitials(name) {
|
|
1422
|
-
if (!name) return "?";
|
|
1423
|
-
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
1424
|
-
return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
|
|
1425
|
-
}
|
|
1426
2894
|
function CallLogRow({ msg, meId, onCallBack }) {
|
|
1427
2895
|
const display = react$1.callLogDisplayFor(msg, meId);
|
|
1428
2896
|
if (!display) return null;
|
|
@@ -1544,7 +3012,7 @@ function AttachmentPreview({ attachment, onClick }) {
|
|
|
1544
3012
|
),
|
|
1545
3013
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-attachment__file-body", children: [
|
|
1546
3014
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-attachment__file-name", children: filename }),
|
|
1547
|
-
byteSize !== null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-attachment__file-meta", children:
|
|
3015
|
+
byteSize !== null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-attachment__file-meta", children: formatBytes2(byteSize) })
|
|
1548
3016
|
] }),
|
|
1549
3017
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1550
3018
|
PoolseIcon,
|
|
@@ -1621,21 +3089,274 @@ function Lightbox({
|
|
|
1621
3089
|
)
|
|
1622
3090
|
]
|
|
1623
3091
|
}
|
|
1624
|
-
);
|
|
3092
|
+
);
|
|
3093
|
+
}
|
|
3094
|
+
function guessContentType(url) {
|
|
3095
|
+
const m = url.match(/\.([a-z0-9]+)(?:\?|#|$)/i);
|
|
3096
|
+
if (!m) return "application/octet-stream";
|
|
3097
|
+
const ext = m[1].toLowerCase();
|
|
3098
|
+
const imageExts = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "avif", "svg"]);
|
|
3099
|
+
if (imageExts.has(ext)) return `image/${ext === "jpg" ? "jpeg" : ext}`;
|
|
3100
|
+
return "application/octet-stream";
|
|
3101
|
+
}
|
|
3102
|
+
function formatBytes2(n) {
|
|
3103
|
+
if (n < 1024) return `${n} B`;
|
|
3104
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
3105
|
+
if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
|
|
3106
|
+
return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
3107
|
+
}
|
|
3108
|
+
var POPOVER_WIDTH = 280;
|
|
3109
|
+
function EditedLabel({ messageId, label = "edited", className }) {
|
|
3110
|
+
const history = useEditHistory(messageId);
|
|
3111
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3112
|
+
history.label(label, className),
|
|
3113
|
+
history.popover
|
|
3114
|
+
] });
|
|
3115
|
+
}
|
|
3116
|
+
function useEditHistory(messageId) {
|
|
3117
|
+
const chat = react$1.usePoolse();
|
|
3118
|
+
const [open, setOpen] = react.useState(false);
|
|
3119
|
+
const [forbidden, setForbidden] = react.useState(false);
|
|
3120
|
+
const [history, setHistory] = react.useState({ status: "idle" });
|
|
3121
|
+
const [position, setPosition] = react.useState(null);
|
|
3122
|
+
const buttonRef = react.useRef(null);
|
|
3123
|
+
const popoverRef = react.useRef(null);
|
|
3124
|
+
react.useEffect(() => {
|
|
3125
|
+
setOpen(false);
|
|
3126
|
+
setForbidden(false);
|
|
3127
|
+
setHistory({ status: "idle" });
|
|
3128
|
+
}, [messageId]);
|
|
3129
|
+
const load = () => {
|
|
3130
|
+
setHistory({ status: "loading" });
|
|
3131
|
+
chat.messages.edits(messageId).then((list) => setHistory({ status: "ready", edits: list.data })).catch((err) => {
|
|
3132
|
+
if (err instanceof react$1.ApiError && err.status === 403) {
|
|
3133
|
+
setForbidden(true);
|
|
3134
|
+
setOpen(false);
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
setHistory({ status: "error" });
|
|
3138
|
+
});
|
|
3139
|
+
};
|
|
3140
|
+
react.useLayoutEffect(() => {
|
|
3141
|
+
if (!open) return;
|
|
3142
|
+
const place = () => {
|
|
3143
|
+
const rect = buttonRef.current?.getBoundingClientRect();
|
|
3144
|
+
if (!rect) return;
|
|
3145
|
+
const vw = window.innerWidth || POPOVER_WIDTH + 16;
|
|
3146
|
+
const left = Math.max(8, Math.min(rect.right - POPOVER_WIDTH, vw - POPOVER_WIDTH - 8));
|
|
3147
|
+
const below = rect.top < 200;
|
|
3148
|
+
setPosition(
|
|
3149
|
+
below ? { position: "fixed", left, top: rect.bottom + 6 } : { position: "fixed", left, top: rect.top - 6, transform: "translateY(-100%)" }
|
|
3150
|
+
);
|
|
3151
|
+
};
|
|
3152
|
+
place();
|
|
3153
|
+
window.addEventListener("resize", place);
|
|
3154
|
+
return () => window.removeEventListener("resize", place);
|
|
3155
|
+
}, [open]);
|
|
3156
|
+
react.useEffect(() => {
|
|
3157
|
+
if (!open) return;
|
|
3158
|
+
const onDown = (e) => {
|
|
3159
|
+
const t = e.target;
|
|
3160
|
+
if (!(t instanceof Node)) return;
|
|
3161
|
+
if (popoverRef.current?.contains(t) || buttonRef.current?.contains(t)) return;
|
|
3162
|
+
setOpen(false);
|
|
3163
|
+
};
|
|
3164
|
+
const onKey = (e) => {
|
|
3165
|
+
if (e.key === "Escape") {
|
|
3166
|
+
setOpen(false);
|
|
3167
|
+
buttonRef.current?.focus();
|
|
3168
|
+
}
|
|
3169
|
+
};
|
|
3170
|
+
const onScroll = (e) => {
|
|
3171
|
+
if (e.target instanceof Node && popoverRef.current?.contains(e.target)) return;
|
|
3172
|
+
setOpen(false);
|
|
3173
|
+
};
|
|
3174
|
+
document.addEventListener("pointerdown", onDown, true);
|
|
3175
|
+
document.addEventListener("keydown", onKey);
|
|
3176
|
+
document.addEventListener("scroll", onScroll, true);
|
|
3177
|
+
return () => {
|
|
3178
|
+
document.removeEventListener("pointerdown", onDown, true);
|
|
3179
|
+
document.removeEventListener("keydown", onKey);
|
|
3180
|
+
document.removeEventListener("scroll", onScroll, true);
|
|
3181
|
+
};
|
|
3182
|
+
}, [open]);
|
|
3183
|
+
const label = (text = "edited", className) => forbidden ? /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: text }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3184
|
+
"button",
|
|
3185
|
+
{
|
|
3186
|
+
ref: buttonRef,
|
|
3187
|
+
type: "button",
|
|
3188
|
+
className: ["poolse-edited-label", className].filter(Boolean).join(" "),
|
|
3189
|
+
"aria-haspopup": "dialog",
|
|
3190
|
+
"aria-expanded": open,
|
|
3191
|
+
title: "Show edit history",
|
|
3192
|
+
onClick: (e) => {
|
|
3193
|
+
e.stopPropagation();
|
|
3194
|
+
const next = !open;
|
|
3195
|
+
setOpen(next);
|
|
3196
|
+
if (next && (history.status === "idle" || history.status === "error")) load();
|
|
3197
|
+
},
|
|
3198
|
+
children: text
|
|
3199
|
+
}
|
|
3200
|
+
);
|
|
3201
|
+
const popover = open ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3202
|
+
"div",
|
|
3203
|
+
{
|
|
3204
|
+
ref: popoverRef,
|
|
3205
|
+
className: "poolse-edit-history",
|
|
3206
|
+
role: "dialog",
|
|
3207
|
+
"aria-label": "Edit history",
|
|
3208
|
+
style: position ?? { position: "fixed", visibility: "hidden" },
|
|
3209
|
+
onClick: (e) => e.stopPropagation(),
|
|
3210
|
+
children: [
|
|
3211
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__title", children: "Edit history" }),
|
|
3212
|
+
history.status === "loading" || history.status === "idle" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__empty", children: "Loading\u2026" }) : history.status === "error" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__empty", children: "Couldn't load the history." }) : history.edits.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__empty", children: "No earlier versions." }) : /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "poolse-edit-history__list", children: history.edits.map((v) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "poolse-edit-history__item", children: [
|
|
3213
|
+
/* @__PURE__ */ jsxRuntime.jsxs("time", { className: "poolse-edit-history__time", dateTime: v.written_at, children: [
|
|
3214
|
+
v.version === 1 ? "Original \xB7 " : "",
|
|
3215
|
+
formatWhen(v.written_at)
|
|
3216
|
+
] }),
|
|
3217
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__body", children: v.body ?? /* @__PURE__ */ jsxRuntime.jsx("em", { children: "(no text)" }) })
|
|
3218
|
+
] }, v.version)) })
|
|
3219
|
+
]
|
|
3220
|
+
}
|
|
3221
|
+
) : null;
|
|
3222
|
+
return { label, popover };
|
|
3223
|
+
}
|
|
3224
|
+
function formatWhen(iso) {
|
|
3225
|
+
const d = new Date(iso);
|
|
3226
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
3227
|
+
return d.toLocaleString(void 0, {
|
|
3228
|
+
month: "short",
|
|
3229
|
+
day: "numeric",
|
|
3230
|
+
hour: "2-digit",
|
|
3231
|
+
minute: "2-digit"
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
function LinkPreviewCard({ preview, onRemove, className }) {
|
|
3235
|
+
const [imageFailed, setImageFailed] = react.useState(false);
|
|
3236
|
+
const [faviconFailed, setFaviconFailed] = react.useState(false);
|
|
3237
|
+
if (!isWebUrl(preview.url)) return null;
|
|
3238
|
+
const image = preview.image_url && isWebUrl(preview.image_url) && !imageFailed;
|
|
3239
|
+
const host = hostOf(preview.url);
|
|
3240
|
+
const remove = onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3241
|
+
"button",
|
|
3242
|
+
{
|
|
3243
|
+
type: "button",
|
|
3244
|
+
className: "poolse-link-preview__remove",
|
|
3245
|
+
"aria-label": "Remove preview",
|
|
3246
|
+
title: "Remove preview",
|
|
3247
|
+
onClick: (e) => {
|
|
3248
|
+
e.preventDefault();
|
|
3249
|
+
e.stopPropagation();
|
|
3250
|
+
onRemove();
|
|
3251
|
+
},
|
|
3252
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 12, label: null })
|
|
3253
|
+
}
|
|
3254
|
+
) : null;
|
|
3255
|
+
if (preview.type === "image") {
|
|
3256
|
+
const src = preview.image_url && isWebUrl(preview.image_url) ? preview.image_url : preview.url;
|
|
3257
|
+
if (imageFailed) return null;
|
|
3258
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3259
|
+
"div",
|
|
3260
|
+
{
|
|
3261
|
+
className: ["poolse-link-preview", "poolse-link-preview--image", className].filter(Boolean).join(" "),
|
|
3262
|
+
children: [
|
|
3263
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: preview.url, target: "_blank", rel: "noopener noreferrer nofollow", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3264
|
+
"img",
|
|
3265
|
+
{
|
|
3266
|
+
className: "poolse-link-preview__picture",
|
|
3267
|
+
src,
|
|
3268
|
+
alt: preview.title ?? host,
|
|
3269
|
+
loading: "lazy",
|
|
3270
|
+
onError: () => setImageFailed(true)
|
|
3271
|
+
}
|
|
3272
|
+
) }),
|
|
3273
|
+
remove
|
|
3274
|
+
]
|
|
3275
|
+
}
|
|
3276
|
+
);
|
|
3277
|
+
}
|
|
3278
|
+
const site = preview.site_name || host;
|
|
3279
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["poolse-link-preview", className].filter(Boolean).join(" "), children: [
|
|
3280
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3281
|
+
"a",
|
|
3282
|
+
{
|
|
3283
|
+
className: "poolse-link-preview__link",
|
|
3284
|
+
href: preview.url,
|
|
3285
|
+
target: "_blank",
|
|
3286
|
+
rel: "noopener noreferrer nofollow",
|
|
3287
|
+
children: [
|
|
3288
|
+
image ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3289
|
+
"img",
|
|
3290
|
+
{
|
|
3291
|
+
className: "poolse-link-preview__image",
|
|
3292
|
+
src: preview.image_url,
|
|
3293
|
+
alt: "",
|
|
3294
|
+
loading: "lazy",
|
|
3295
|
+
onError: () => setImageFailed(true)
|
|
3296
|
+
}
|
|
3297
|
+
) : null,
|
|
3298
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-link-preview__text", children: [
|
|
3299
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-link-preview__site", children: [
|
|
3300
|
+
preview.favicon_url && isWebUrl(preview.favicon_url) && !faviconFailed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3301
|
+
"img",
|
|
3302
|
+
{
|
|
3303
|
+
className: "poolse-link-preview__favicon",
|
|
3304
|
+
src: preview.favicon_url,
|
|
3305
|
+
alt: "",
|
|
3306
|
+
loading: "lazy",
|
|
3307
|
+
onError: () => setFaviconFailed(true)
|
|
3308
|
+
}
|
|
3309
|
+
) : null,
|
|
3310
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: site })
|
|
3311
|
+
] }),
|
|
3312
|
+
preview.title ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-link-preview__title", children: preview.title }) : null,
|
|
3313
|
+
preview.description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-link-preview__description", children: preview.description }) : null
|
|
3314
|
+
] })
|
|
3315
|
+
]
|
|
3316
|
+
}
|
|
3317
|
+
),
|
|
3318
|
+
remove
|
|
3319
|
+
] });
|
|
1625
3320
|
}
|
|
1626
|
-
function
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1632
|
-
|
|
3321
|
+
function MessageLinkPreviews({
|
|
3322
|
+
message,
|
|
3323
|
+
canRemove
|
|
3324
|
+
}) {
|
|
3325
|
+
const chat = react$1.usePoolse();
|
|
3326
|
+
const [hidden, setHidden] = react.useState(() => /* @__PURE__ */ new Set());
|
|
3327
|
+
const previews = (message.link_previews ?? []).filter((p) => !hidden.has(p.url));
|
|
3328
|
+
if (message.deleted_at || previews.length === 0) return null;
|
|
3329
|
+
const remove = (url) => {
|
|
3330
|
+
setHidden((prev) => new Set(prev).add(url));
|
|
3331
|
+
void chat.messages.update(message.id, { remove_link_previews: [url] }).catch(() => {
|
|
3332
|
+
setHidden((prev) => {
|
|
3333
|
+
const next = new Set(prev);
|
|
3334
|
+
next.delete(url);
|
|
3335
|
+
return next;
|
|
3336
|
+
});
|
|
3337
|
+
});
|
|
3338
|
+
};
|
|
3339
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-link-previews", children: previews.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3340
|
+
LinkPreviewCard,
|
|
3341
|
+
{
|
|
3342
|
+
preview: p,
|
|
3343
|
+
...canRemove ? { onRemove: () => remove(p.url) } : {}
|
|
3344
|
+
},
|
|
3345
|
+
p.url
|
|
3346
|
+
)) });
|
|
1633
3347
|
}
|
|
1634
|
-
function
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
return
|
|
3348
|
+
function hasLinkPreviews(message) {
|
|
3349
|
+
return !message.deleted_at && (message.link_previews?.length ?? 0) > 0;
|
|
3350
|
+
}
|
|
3351
|
+
function isWebUrl(url) {
|
|
3352
|
+
return /^https?:\/\//i.test(url);
|
|
3353
|
+
}
|
|
3354
|
+
function hostOf(url) {
|
|
3355
|
+
try {
|
|
3356
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
3357
|
+
} catch {
|
|
3358
|
+
return url;
|
|
3359
|
+
}
|
|
1639
3360
|
}
|
|
1640
3361
|
|
|
1641
3362
|
// src/bubbleText.ts
|
|
@@ -1672,6 +3393,7 @@ function MessageBubble({
|
|
|
1672
3393
|
actionsTrigger,
|
|
1673
3394
|
showAttachments = true,
|
|
1674
3395
|
timeFormat,
|
|
3396
|
+
linkPreviews = true,
|
|
1675
3397
|
slots,
|
|
1676
3398
|
slotContext
|
|
1677
3399
|
}) {
|
|
@@ -1695,7 +3417,8 @@ function MessageBubble({
|
|
|
1695
3417
|
const metaOverlay = hasAnyAttachment && imageAttachments.length > 0 && !hasVisibleBody && fileAttachments.length === 0;
|
|
1696
3418
|
const jumboCount = hasVisibleBody && !hasAnyAttachment && !message.quoted_message_id ? emojiOnlyCount(rawBody) : 0;
|
|
1697
3419
|
const trimToggleVisible = shouldTrim || expanded && rawBody.length > maxBodyLength + TRIM_BUFFER2;
|
|
1698
|
-
const
|
|
3420
|
+
const showPreviews = linkPreviews && hasLinkPreviews(message);
|
|
3421
|
+
const inlineMeta = hasVisibleBody && !showPreviews && jumboCount === 0 && !trimToggleVisible && (!markdown || !hasMarkdown(displayBody));
|
|
1699
3422
|
const className = [
|
|
1700
3423
|
"poolse-message",
|
|
1701
3424
|
isSelf ? "poolse-message--self" : "poolse-message--other",
|
|
@@ -1709,7 +3432,8 @@ function MessageBubble({
|
|
|
1709
3432
|
jumboCount > 0 ? "poolse-message--jumbo" : ""
|
|
1710
3433
|
].filter(Boolean).join(" ");
|
|
1711
3434
|
const time = formatMessageTime(message.inserted_at, timeFormat);
|
|
1712
|
-
const
|
|
3435
|
+
const editHistory = useEditHistory(message.id);
|
|
3436
|
+
const showQuoteCard = message.deleted_at ? null : message.quoted_message !== void 0 && message.quoted_message !== null ? "full" : message.quoted_message_id ? "placeholder" : null;
|
|
1713
3437
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
1714
3438
|
actionsTrigger,
|
|
1715
3439
|
renderSlot(
|
|
@@ -1745,9 +3469,12 @@ function MessageBubble({
|
|
|
1745
3469
|
] }) : null
|
|
1746
3470
|
),
|
|
1747
3471
|
(() => {
|
|
1748
|
-
const
|
|
3472
|
+
const metaParts = (interactive) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1749
3473
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: time }),
|
|
1750
|
-
message.edited_at && !message.deleted_at ? /* @__PURE__ */ jsxRuntime.
|
|
3474
|
+
message.edited_at && !message.deleted_at ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3475
|
+
"\xB7 ",
|
|
3476
|
+
interactive ? editHistory.label() : "edited"
|
|
3477
|
+
] }) : null,
|
|
1751
3478
|
isSelf && readState ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1752
3479
|
PoolseIcon,
|
|
1753
3480
|
{
|
|
@@ -1757,7 +3484,8 @@ function MessageBubble({
|
|
|
1757
3484
|
}
|
|
1758
3485
|
) : null
|
|
1759
3486
|
] });
|
|
1760
|
-
const
|
|
3487
|
+
const metaContent = metaParts(true);
|
|
3488
|
+
const body = message.deleted_at ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "This message was deleted" }) : hasVisibleBody ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1761
3489
|
"div",
|
|
1762
3490
|
{
|
|
1763
3491
|
className: markdown && !inlineMeta && jumboCount === 0 ? "poolse-message__body poolse-message__body--md" : "poolse-message__body",
|
|
@@ -1787,7 +3515,7 @@ function MessageBubble({
|
|
|
1787
3515
|
// overlaps a glyph — and when the line is full, the
|
|
1788
3516
|
// reservation wraps and the meta drops a line, flush
|
|
1789
3517
|
// right. The WhatsApp trick.
|
|
1790
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__meta poolse-message__meta--spacer", "aria-hidden": true, children:
|
|
3518
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__meta poolse-message__meta--spacer", "aria-hidden": true, children: metaParts(false) }),
|
|
1791
3519
|
shouldTrim && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1792
3520
|
"button",
|
|
1793
3521
|
{
|
|
@@ -1818,7 +3546,9 @@ function MessageBubble({
|
|
|
1818
3546
|
const metaClass = metaOverlay ? "poolse-message__meta poolse-message__meta--overlay" : inlineMeta ? "poolse-message__meta poolse-message__meta--inline" : "poolse-message__meta poolse-message__meta--block";
|
|
1819
3547
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1820
3548
|
renderSlot(slots?.body, slotContext, body),
|
|
1821
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3549
|
+
showPreviews ? /* @__PURE__ */ jsxRuntime.jsx(MessageLinkPreviews, { message, canRemove: isSelf }) : null,
|
|
3550
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: metaClass, children: metaContent }),
|
|
3551
|
+
editHistory.popover
|
|
1822
3552
|
] });
|
|
1823
3553
|
})()
|
|
1824
3554
|
] });
|
|
@@ -1878,7 +3608,7 @@ function QuotedCard({
|
|
|
1878
3608
|
"button",
|
|
1879
3609
|
{
|
|
1880
3610
|
type: "button",
|
|
1881
|
-
className: `poolse-quote ${isSelf ? "poolse-quote--self" : "poolse-quote--other"}`,
|
|
3611
|
+
className: `poolse-quote ${isSelf ? "poolse-quote--self" : "poolse-quote--other"}${isDeleted ? " poolse-quote--deleted" : ""}`,
|
|
1882
3612
|
onClick: handleClick,
|
|
1883
3613
|
disabled: !handleClick,
|
|
1884
3614
|
"aria-label": `Quoted message from ${senderLabel}`,
|
|
@@ -2043,10 +3773,15 @@ function ReactionPicker({
|
|
|
2043
3773
|
onClose
|
|
2044
3774
|
}) {
|
|
2045
3775
|
const rootRef = react.useRef(null);
|
|
3776
|
+
const [full, setFull] = react.useState(false);
|
|
2046
3777
|
react.useEffect(() => {
|
|
2047
3778
|
const firstBtn = rootRef.current?.querySelector("button");
|
|
2048
3779
|
if (firstBtn instanceof HTMLElement) firstBtn.focus();
|
|
2049
3780
|
}, []);
|
|
3781
|
+
const pick = (emoji) => {
|
|
3782
|
+
rememberEmoji(emoji);
|
|
3783
|
+
onPick(emoji);
|
|
3784
|
+
};
|
|
2050
3785
|
react.useEffect(() => {
|
|
2051
3786
|
if (!onClose) return;
|
|
2052
3787
|
const onPointer = (e) => {
|
|
@@ -2075,7 +3810,10 @@ function ReactionPicker({
|
|
|
2075
3810
|
e.preventDefault();
|
|
2076
3811
|
}
|
|
2077
3812
|
};
|
|
2078
|
-
|
|
3813
|
+
if (full) {
|
|
3814
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: rootRef, className: "poolse-reaction-picker poolse-reaction-picker--full", children: /* @__PURE__ */ jsxRuntime.jsx(EmojiPicker, { onPick: pick, ...onClose ? { onClose } : {} }) });
|
|
3815
|
+
}
|
|
3816
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2079
3817
|
"div",
|
|
2080
3818
|
{
|
|
2081
3819
|
ref: rootRef,
|
|
@@ -2083,18 +3821,34 @@ function ReactionPicker({
|
|
|
2083
3821
|
role: "menu",
|
|
2084
3822
|
"aria-label": "Pick a reaction",
|
|
2085
3823
|
onKeyDown: onKey,
|
|
2086
|
-
children:
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
3824
|
+
children: [
|
|
3825
|
+
COMMON_EMOJIS.map((e) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3826
|
+
"button",
|
|
3827
|
+
{
|
|
3828
|
+
type: "button",
|
|
3829
|
+
role: "menuitem",
|
|
3830
|
+
className: "poolse-reaction-picker__btn",
|
|
3831
|
+
onClick: () => pick(e),
|
|
3832
|
+
"aria-label": `React with ${e}`,
|
|
3833
|
+
children: e
|
|
3834
|
+
},
|
|
3835
|
+
e
|
|
3836
|
+
)),
|
|
3837
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3838
|
+
"button",
|
|
3839
|
+
{
|
|
3840
|
+
type: "button",
|
|
3841
|
+
role: "menuitem",
|
|
3842
|
+
className: "poolse-reaction-picker__btn poolse-reaction-picker__more",
|
|
3843
|
+
"aria-label": "More emoji",
|
|
3844
|
+
title: "More emoji",
|
|
3845
|
+
onPointerEnter: () => void loadEmojiData(),
|
|
3846
|
+
onFocus: () => void loadEmojiData(),
|
|
3847
|
+
onClick: () => setFull(true),
|
|
3848
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "plus", size: 16, label: null })
|
|
3849
|
+
}
|
|
3850
|
+
)
|
|
3851
|
+
]
|
|
2098
3852
|
}
|
|
2099
3853
|
);
|
|
2100
3854
|
}
|
|
@@ -2103,6 +3857,7 @@ function MessageActions({
|
|
|
2103
3857
|
onReply,
|
|
2104
3858
|
onQuote,
|
|
2105
3859
|
onCopy,
|
|
3860
|
+
onMarkUnread,
|
|
2106
3861
|
onEdit,
|
|
2107
3862
|
onDelete,
|
|
2108
3863
|
moreMenu = false,
|
|
@@ -2110,7 +3865,7 @@ function MessageActions({
|
|
|
2110
3865
|
}) {
|
|
2111
3866
|
const [pickerOpen, setPickerOpen] = react.useState(false);
|
|
2112
3867
|
const [menuOpen, setMenuOpen] = react.useState(false);
|
|
2113
|
-
const hasMore = !!(onCopy || onEdit || onDelete);
|
|
3868
|
+
const hasMore = !!(onCopy || onMarkUnread || onEdit || onDelete);
|
|
2114
3869
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-msg-actions", role: "toolbar", "aria-label": "Message actions", children: [
|
|
2115
3870
|
onReact && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2116
3871
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2157,6 +3912,11 @@ function MessageActions({
|
|
|
2157
3912
|
},
|
|
2158
3913
|
children: [
|
|
2159
3914
|
onCopy && { label: "Copy", icon: "copy", run: onCopy },
|
|
3915
|
+
onMarkUnread && {
|
|
3916
|
+
label: "Mark unread",
|
|
3917
|
+
icon: "message",
|
|
3918
|
+
run: onMarkUnread
|
|
3919
|
+
},
|
|
2160
3920
|
onEdit && { label: "Edit", icon: "edit", run: onEdit },
|
|
2161
3921
|
onDelete && { label: "Delete", icon: "trash", run: onDelete }
|
|
2162
3922
|
].filter((item) => !!item).map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2183,6 +3943,7 @@ function MessageActions({
|
|
|
2183
3943
|
onReply && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Reply in thread", icon: "messages", onClick: onReply }),
|
|
2184
3944
|
onQuote && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Reply", icon: "reply", onClick: onQuote }),
|
|
2185
3945
|
onCopy && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Copy", icon: "copy", onClick: onCopy }),
|
|
3946
|
+
onMarkUnread && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Mark unread", icon: "message", onClick: onMarkUnread }),
|
|
2186
3947
|
onEdit && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Edit", icon: "edit", onClick: onEdit }),
|
|
2187
3948
|
onDelete && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Delete", icon: "trash", danger: true, onClick: onDelete }),
|
|
2188
3949
|
children
|
|
@@ -2255,6 +4016,36 @@ function InlineReactions({
|
|
|
2255
4016
|
);
|
|
2256
4017
|
}) });
|
|
2257
4018
|
}
|
|
4019
|
+
function ThreadSummary({ message, onOpen, maxAvatars = 3, className }) {
|
|
4020
|
+
const now = useNow();
|
|
4021
|
+
const count = message.reply_count ?? 0;
|
|
4022
|
+
if (count <= 0) return null;
|
|
4023
|
+
const participants = (message.thread_participants ?? []).slice(0, maxAvatars);
|
|
4024
|
+
const replies = `${count} ${count === 1 ? "reply" : "replies"}`;
|
|
4025
|
+
const last = formatRelativeTime(message.last_reply_at, now);
|
|
4026
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4027
|
+
"button",
|
|
4028
|
+
{
|
|
4029
|
+
type: "button",
|
|
4030
|
+
className: ["poolse-thread-summary", className].filter(Boolean).join(" "),
|
|
4031
|
+
onClick: onOpen,
|
|
4032
|
+
"aria-label": `View ${replies}`,
|
|
4033
|
+
children: [
|
|
4034
|
+
participants.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-thread-summary__avatars", "aria-hidden": "true", children: participants.map((p) => /* @__PURE__ */ jsxRuntime.jsx(ParticipantAvatar, { participant: p }, p.user_id)) }) : /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 12, label: null }),
|
|
4035
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-thread-summary__count", children: replies }),
|
|
4036
|
+
last ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-thread-summary__last", children: [
|
|
4037
|
+
"\xB7 last reply ",
|
|
4038
|
+
last
|
|
4039
|
+
] }) : null
|
|
4040
|
+
]
|
|
4041
|
+
}
|
|
4042
|
+
);
|
|
4043
|
+
}
|
|
4044
|
+
function ParticipantAvatar({ participant }) {
|
|
4045
|
+
const { profile } = react$1.useUser(participant.external_id);
|
|
4046
|
+
const name = profile?.displayName ?? participant.external_id ?? "Someone";
|
|
4047
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: profile?.avatarUrl ?? null, name, size: "xs" });
|
|
4048
|
+
}
|
|
2258
4049
|
var TRIM_BUFFER = 40;
|
|
2259
4050
|
function FlatMessageRow({
|
|
2260
4051
|
msg,
|
|
@@ -2273,12 +4064,15 @@ function FlatMessageRow({
|
|
|
2273
4064
|
onDelete,
|
|
2274
4065
|
onOpenThread,
|
|
2275
4066
|
onQuote,
|
|
4067
|
+
onMarkUnread,
|
|
2276
4068
|
labelFor,
|
|
2277
4069
|
onQuotedClick,
|
|
2278
4070
|
groupPosition = "standalone",
|
|
2279
4071
|
maxBodyLength = 0,
|
|
2280
4072
|
markdown = false,
|
|
2281
4073
|
showAvatar = layout === "list",
|
|
4074
|
+
showPresence = false,
|
|
4075
|
+
linkPreviews = true,
|
|
2282
4076
|
onSenderPress,
|
|
2283
4077
|
onAvatarPress,
|
|
2284
4078
|
timeFormat,
|
|
@@ -2306,10 +4100,19 @@ function FlatMessageRow({
|
|
|
2306
4100
|
const deleted = !!msg.deleted_at;
|
|
2307
4101
|
const time = formatMessageTime(msg.inserted_at, timeFormat);
|
|
2308
4102
|
const replyCount = msg.reply_count ?? 0;
|
|
2309
|
-
const showThreadLink = threads && !
|
|
4103
|
+
const showThreadLink = threads && !msg.thread_root_id && replyCount > 0;
|
|
2310
4104
|
const showActions = actions && !deleted && !editing;
|
|
2311
4105
|
const timeEl = (className) => /* @__PURE__ */ jsxRuntime.jsx("time", { className, dateTime: msg.inserted_at, children: time });
|
|
2312
4106
|
const avatarSize = compact ? "sm" : "md";
|
|
4107
|
+
const avatarEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4108
|
+
Avatar,
|
|
4109
|
+
{
|
|
4110
|
+
src: sender.avatarUrl,
|
|
4111
|
+
name: senderName,
|
|
4112
|
+
size: avatarSize,
|
|
4113
|
+
...showPresence && msg.sender_external_id ? { presence: true, userId: msg.sender_external_id } : {}
|
|
4114
|
+
}
|
|
4115
|
+
);
|
|
2313
4116
|
const avatar = !showAvatar ? null : onAvatarPress && !isSelf ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2314
4117
|
"button",
|
|
2315
4118
|
{
|
|
@@ -2317,9 +4120,9 @@ function FlatMessageRow({
|
|
|
2317
4120
|
className: "poolse-row__avatar-button",
|
|
2318
4121
|
"aria-label": senderName,
|
|
2319
4122
|
onClick: () => onAvatarPress(sender),
|
|
2320
|
-
children:
|
|
4123
|
+
children: avatarEl
|
|
2321
4124
|
}
|
|
2322
|
-
) :
|
|
4125
|
+
) : avatarEl;
|
|
2323
4126
|
const nameStyle = compact ? { color: userColor(msg.sender_external_id ?? msg.sender_id ?? "") } : void 0;
|
|
2324
4127
|
const name = onSenderPress && !isSelf ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2325
4128
|
"button",
|
|
@@ -2335,7 +4138,7 @@ function FlatMessageRow({
|
|
|
2335
4138
|
name,
|
|
2336
4139
|
timeEl("poolse-row__time")
|
|
2337
4140
|
] }) : null;
|
|
2338
|
-
const quote = msg.quoted_message !== void 0 && msg.quoted_message !== null ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4141
|
+
const quote = deleted ? null : msg.quoted_message !== void 0 && msg.quoted_message !== null ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2339
4142
|
QuotedCard,
|
|
2340
4143
|
{
|
|
2341
4144
|
quoted: msg.quoted_message,
|
|
@@ -2351,8 +4154,14 @@ function FlatMessageRow({
|
|
|
2351
4154
|
images.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ImageMosaic, { images }),
|
|
2352
4155
|
files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__files", children: files.map((att) => /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreview, { attachment: att }, att.id)) })
|
|
2353
4156
|
] }) : null;
|
|
4157
|
+
const editHistory = useEditHistory(msg.id);
|
|
2354
4158
|
const meta = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2355
|
-
msg.edited_at && !deleted ? /* @__PURE__ */ jsxRuntime.
|
|
4159
|
+
msg.edited_at && !deleted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-row__edited", children: [
|
|
4160
|
+
"(",
|
|
4161
|
+
editHistory.label(),
|
|
4162
|
+
")"
|
|
4163
|
+
] }) : null,
|
|
4164
|
+
editHistory.popover,
|
|
2356
4165
|
isSelf && readState ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-row__receipt", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2357
4166
|
PoolseIcon,
|
|
2358
4167
|
{
|
|
@@ -2394,21 +4203,12 @@ function FlatMessageRow({
|
|
|
2394
4203
|
onRemove: (e) => void reactionsHook.removeReaction(e)
|
|
2395
4204
|
}
|
|
2396
4205
|
) : null;
|
|
2397
|
-
const threadEl = showThreadLink ? /* @__PURE__ */ jsxRuntime.
|
|
2398
|
-
|
|
4206
|
+
const threadEl = showThreadLink ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4207
|
+
ThreadSummary,
|
|
2399
4208
|
{
|
|
2400
|
-
|
|
4209
|
+
message: msg,
|
|
2401
4210
|
className: "poolse-row__thread",
|
|
2402
|
-
|
|
2403
|
-
"aria-label": `View ${replyCount} ${replyCount === 1 ? "reply" : "replies"}`,
|
|
2404
|
-
children: [
|
|
2405
|
-
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 14, label: null }),
|
|
2406
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2407
|
-
replyCount,
|
|
2408
|
-
" ",
|
|
2409
|
-
replyCount === 1 ? "reply" : "replies"
|
|
2410
|
-
] })
|
|
2411
|
-
]
|
|
4211
|
+
...onOpenThread ? { onOpen: onOpenThread } : {}
|
|
2412
4212
|
}
|
|
2413
4213
|
) : null;
|
|
2414
4214
|
const toolbar = showActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-row__toolbar", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2423,6 +4223,7 @@ function FlatMessageRow({
|
|
|
2423
4223
|
void navigator?.clipboard?.writeText(msg.body ?? "").catch(() => void 0);
|
|
2424
4224
|
}
|
|
2425
4225
|
} : {},
|
|
4226
|
+
...!isSelf && onMarkUnread ? { onMarkUnread } : {},
|
|
2426
4227
|
...isSelf && onStartEdit ? { onEdit: onStartEdit } : {},
|
|
2427
4228
|
...isSelf && onDelete ? { onDelete } : {}
|
|
2428
4229
|
}
|
|
@@ -2432,6 +4233,7 @@ function FlatMessageRow({
|
|
|
2432
4233
|
quote,
|
|
2433
4234
|
renderSlot(slots?.attachments, ctx, attachmentsEl),
|
|
2434
4235
|
renderSlot(slots?.body, ctx, body),
|
|
4236
|
+
linkPreviews && !editing && hasLinkPreviews(msg) ? /* @__PURE__ */ jsxRuntime.jsx(MessageLinkPreviews, { message: msg, canRemove: isSelf }) : null,
|
|
2435
4237
|
renderSlot(slots?.reactions, ctx, reactionsEl),
|
|
2436
4238
|
renderSlot(slots?.thread, ctx, threadEl)
|
|
2437
4239
|
] });
|
|
@@ -2474,7 +4276,7 @@ function FlatBody({
|
|
|
2474
4276
|
}) {
|
|
2475
4277
|
const [expanded, setExpanded] = react.useState(false);
|
|
2476
4278
|
if (message.deleted_at) {
|
|
2477
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__body poolse-row__body", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "
|
|
4279
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__body poolse-row__body", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "This message was deleted" }) });
|
|
2478
4280
|
}
|
|
2479
4281
|
const raw = message.body ?? "";
|
|
2480
4282
|
if (!raw) {
|
|
@@ -2549,6 +4351,7 @@ function BubbleMessageRow({
|
|
|
2549
4351
|
onDelete,
|
|
2550
4352
|
onOpenThread,
|
|
2551
4353
|
onQuote,
|
|
4354
|
+
onMarkUnread,
|
|
2552
4355
|
labelFor,
|
|
2553
4356
|
onQuotedClick,
|
|
2554
4357
|
groupPosition = "standalone",
|
|
@@ -2556,6 +4359,8 @@ function BubbleMessageRow({
|
|
|
2556
4359
|
markdown = false,
|
|
2557
4360
|
showSenderName = false,
|
|
2558
4361
|
showAvatar = false,
|
|
4362
|
+
showPresence = false,
|
|
4363
|
+
linkPreviews = true,
|
|
2559
4364
|
onSenderPress,
|
|
2560
4365
|
onAvatarPress,
|
|
2561
4366
|
timeFormat,
|
|
@@ -2579,7 +4384,7 @@ function BubbleMessageRow({
|
|
|
2579
4384
|
const showReactions = reactions && !msg.deleted_at;
|
|
2580
4385
|
const showActions = actions && !msg.deleted_at && !editing;
|
|
2581
4386
|
const replyCount = msg.reply_count ?? 0;
|
|
2582
|
-
const showThreadPill = threads && !msg.
|
|
4387
|
+
const showThreadPill = threads && !msg.thread_root_id && replyCount > 0;
|
|
2583
4388
|
const handleSave = onSaveEdit ?? (async () => void 0);
|
|
2584
4389
|
const handleCancel = onCancelEdit ?? (() => void 0);
|
|
2585
4390
|
const { actionsOpen, setActionsOpen, rowRef, onRowClick } = useRowActions();
|
|
@@ -2626,6 +4431,7 @@ function BubbleMessageRow({
|
|
|
2626
4431
|
groupPosition,
|
|
2627
4432
|
senderName,
|
|
2628
4433
|
avatarUrl: senderProfile?.avatarUrl ?? null,
|
|
4434
|
+
presenceId: showPresence ? msg.sender_external_id : null,
|
|
2629
4435
|
...onAvatarPress ? { onAvatarPress: () => onAvatarPress(sender) } : {},
|
|
2630
4436
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2631
4437
|
MessageBubble,
|
|
@@ -2638,6 +4444,7 @@ function BubbleMessageRow({
|
|
|
2638
4444
|
showSenderName,
|
|
2639
4445
|
...onSenderPress ? { onSenderPress: () => onSenderPress(sender) } : {},
|
|
2640
4446
|
showAttachments: attachments,
|
|
4447
|
+
linkPreviews,
|
|
2641
4448
|
...readState ? { readState } : {},
|
|
2642
4449
|
...labelFor ? { labelFor } : {},
|
|
2643
4450
|
...onQuotedClick ? { onQuotedClick } : {},
|
|
@@ -2679,21 +4486,12 @@ function BubbleMessageRow({
|
|
|
2679
4486
|
renderSlot(
|
|
2680
4487
|
slots?.thread,
|
|
2681
4488
|
slotContext,
|
|
2682
|
-
showThreadPill ? /* @__PURE__ */ jsxRuntime.
|
|
2683
|
-
|
|
4489
|
+
showThreadPill ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4490
|
+
ThreadSummary,
|
|
2684
4491
|
{
|
|
2685
|
-
|
|
4492
|
+
message: msg,
|
|
2686
4493
|
className: `poolse-thread-pill ${isSelf ? "poolse-thread-pill--right" : "poolse-thread-pill--left"}`,
|
|
2687
|
-
|
|
2688
|
-
"aria-label": `View ${replyCount} ${replyCount === 1 ? "reply" : "replies"}`,
|
|
2689
|
-
children: [
|
|
2690
|
-
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 12, label: null }),
|
|
2691
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2692
|
-
replyCount,
|
|
2693
|
-
" ",
|
|
2694
|
-
replyCount === 1 ? "reply" : "replies"
|
|
2695
|
-
] })
|
|
2696
|
-
]
|
|
4494
|
+
...onOpenThread ? { onOpen: onOpenThread } : {}
|
|
2697
4495
|
}
|
|
2698
4496
|
) : null
|
|
2699
4497
|
),
|
|
@@ -2719,6 +4517,7 @@ function BubbleMessageRow({
|
|
|
2719
4517
|
void navigator?.clipboard?.writeText(msg.body ?? "").catch(() => void 0);
|
|
2720
4518
|
}
|
|
2721
4519
|
} : {},
|
|
4520
|
+
...!isSelf && onMarkUnread ? { onMarkUnread } : {},
|
|
2722
4521
|
...isSelf && onStartEdit ? { onEdit: onStartEdit } : {},
|
|
2723
4522
|
...isSelf && onDelete ? { onDelete } : {}
|
|
2724
4523
|
}
|
|
@@ -2736,11 +4535,21 @@ function BubbleWithAvatar({
|
|
|
2736
4535
|
groupPosition,
|
|
2737
4536
|
senderName,
|
|
2738
4537
|
avatarUrl,
|
|
4538
|
+
presenceId,
|
|
2739
4539
|
onAvatarPress,
|
|
2740
4540
|
children
|
|
2741
4541
|
}) {
|
|
2742
4542
|
if (isSelf || !showAvatar) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2743
4543
|
const isLastOfCluster = groupPosition === "last" || groupPosition === "standalone";
|
|
4544
|
+
const avatar = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4545
|
+
Avatar,
|
|
4546
|
+
{
|
|
4547
|
+
src: avatarUrl,
|
|
4548
|
+
name: senderName,
|
|
4549
|
+
size: "sm",
|
|
4550
|
+
...presenceId ? { presence: true, userId: presenceId } : {}
|
|
4551
|
+
}
|
|
4552
|
+
);
|
|
2744
4553
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-bubble-shell", children: [
|
|
2745
4554
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-bubble-shell__avatar", children: !isLastOfCluster ? null : onAvatarPress ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2746
4555
|
"button",
|
|
@@ -2749,9 +4558,9 @@ function BubbleWithAvatar({
|
|
|
2749
4558
|
className: "poolse-bubble-shell__avatar-button",
|
|
2750
4559
|
"aria-label": senderName,
|
|
2751
4560
|
onClick: onAvatarPress,
|
|
2752
|
-
children:
|
|
4561
|
+
children: avatar
|
|
2753
4562
|
}
|
|
2754
|
-
) :
|
|
4563
|
+
) : avatar }),
|
|
2755
4564
|
children
|
|
2756
4565
|
] });
|
|
2757
4566
|
}
|
|
@@ -2761,7 +4570,9 @@ function ThreadView({
|
|
|
2761
4570
|
onClose,
|
|
2762
4571
|
renderMessage,
|
|
2763
4572
|
layout,
|
|
2764
|
-
timeFormat
|
|
4573
|
+
timeFormat,
|
|
4574
|
+
maxFileSize,
|
|
4575
|
+
acceptFileTypes
|
|
2765
4576
|
}) {
|
|
2766
4577
|
const { me } = react$1.useMe();
|
|
2767
4578
|
const {
|
|
@@ -2896,7 +4707,9 @@ function ThreadView({
|
|
|
2896
4707
|
body,
|
|
2897
4708
|
...opts?.attachment_ids && opts.attachment_ids.length > 0 ? { attachment_ids: opts.attachment_ids } : {}
|
|
2898
4709
|
}),
|
|
2899
|
-
placeholder: "Reply in thread\u2026"
|
|
4710
|
+
placeholder: "Reply in thread\u2026",
|
|
4711
|
+
...maxFileSize !== void 0 ? { maxFileSize } : {},
|
|
4712
|
+
...acceptFileTypes ? { acceptFileTypes } : {}
|
|
2900
4713
|
}
|
|
2901
4714
|
),
|
|
2902
4715
|
dragActive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__drop-overlay", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation__drop-overlay-inner", children: [
|
|
@@ -2908,6 +4721,31 @@ function ThreadView({
|
|
|
2908
4721
|
}
|
|
2909
4722
|
);
|
|
2910
4723
|
}
|
|
4724
|
+
var MAX_NAME_CHARS = 24;
|
|
4725
|
+
function UserName({
|
|
4726
|
+
externalId,
|
|
4727
|
+
labelFor,
|
|
4728
|
+
emptyFallback = "Unknown",
|
|
4729
|
+
className
|
|
4730
|
+
}) {
|
|
4731
|
+
const { profile } = react$1.useUser(labelFor ? null : externalId);
|
|
4732
|
+
const name = resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
|
|
4733
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: truncate(name) });
|
|
4734
|
+
}
|
|
4735
|
+
function useDisplayName(externalId, labelFor, emptyFallback = "Unknown") {
|
|
4736
|
+
const { profile } = react$1.useUser(labelFor ? null : externalId);
|
|
4737
|
+
return resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
|
|
4738
|
+
}
|
|
4739
|
+
function resolveDisplayName(externalId, resolved, labelFor, emptyFallback) {
|
|
4740
|
+
if (!externalId) return emptyFallback;
|
|
4741
|
+
if (labelFor) return labelFor(externalId);
|
|
4742
|
+
if (resolved) return resolved;
|
|
4743
|
+
return externalId;
|
|
4744
|
+
}
|
|
4745
|
+
function truncate(s) {
|
|
4746
|
+
if (s.length <= MAX_NAME_CHARS) return s;
|
|
4747
|
+
return s.slice(0, MAX_NAME_CHARS - 1) + "\u2026";
|
|
4748
|
+
}
|
|
2911
4749
|
function TypingIndicator({ typing, labelFor }) {
|
|
2912
4750
|
const ids = Array.from(typing);
|
|
2913
4751
|
const isTyping = ids.length > 0;
|
|
@@ -2955,10 +4793,14 @@ function ConversationView({
|
|
|
2955
4793
|
reactions = TRUE,
|
|
2956
4794
|
mentions = TRUE,
|
|
2957
4795
|
attachments = TRUE,
|
|
4796
|
+
maxFileSize,
|
|
4797
|
+
acceptFileTypes,
|
|
4798
|
+
emojiPicker = TRUE,
|
|
2958
4799
|
actions = TRUE,
|
|
2959
4800
|
threads = TRUE,
|
|
2960
4801
|
quotations = TRUE,
|
|
2961
4802
|
readReceipts = TRUE,
|
|
4803
|
+
linkPreviews = TRUE,
|
|
2962
4804
|
markdown = TRUE,
|
|
2963
4805
|
maxBodyLength = 200,
|
|
2964
4806
|
grouping = TRUE,
|
|
@@ -2967,6 +4809,7 @@ function ConversationView({
|
|
|
2967
4809
|
layout = "bubbles",
|
|
2968
4810
|
density = "comfortable",
|
|
2969
4811
|
showAvatars,
|
|
4812
|
+
showPresence = false,
|
|
2970
4813
|
timeFormat,
|
|
2971
4814
|
slots,
|
|
2972
4815
|
daySeparators = TRUE,
|
|
@@ -2981,7 +4824,9 @@ function ConversationView({
|
|
|
2981
4824
|
readOnly = false,
|
|
2982
4825
|
onCallBack,
|
|
2983
4826
|
onJoinCall,
|
|
2984
|
-
currentCallId = null
|
|
4827
|
+
currentCallId = null,
|
|
4828
|
+
persistDrafts = TRUE,
|
|
4829
|
+
draftStorage
|
|
2985
4830
|
}) {
|
|
2986
4831
|
usePoolseFonts(loadFonts);
|
|
2987
4832
|
const showComposer = composer && !readOnly;
|
|
@@ -3013,13 +4858,16 @@ function ConversationView({
|
|
|
3013
4858
|
const status = react$1.useRealtimeStatus();
|
|
3014
4859
|
const wantsMemberCount = senderLabels === "auto" || avatars === "auto";
|
|
3015
4860
|
const membersOn = mentions || readReceipts || wantsMemberCount;
|
|
3016
|
-
const { members } = react$1.useMembers(membersOn ? conversationId : "");
|
|
4861
|
+
const { members, loading: membersLoading } = react$1.useMembers(membersOn ? conversationId : "");
|
|
4862
|
+
const chat = react$1.usePoolse();
|
|
3017
4863
|
const isGroupChat = members.length > 2;
|
|
3018
4864
|
const showSenderLabelsResolved = senderLabels === "always" || senderLabels === "auto" && isGroupChat;
|
|
3019
4865
|
const showAvatarsResolved = showAvatars ?? (layout === "list" ? true : layout === "compact" ? false : avatars === "always" || avatars === "auto" && isGroupChat);
|
|
3020
4866
|
const groupWindowMs = groupWindowMinutes !== void 0 ? groupWindowMinutes * 60 * 1e3 : groupingWindowMs ?? 5 * 60 * 1e3;
|
|
3021
4867
|
const layoutProps = {
|
|
3022
4868
|
layout,
|
|
4869
|
+
showPresence,
|
|
4870
|
+
linkPreviews,
|
|
3023
4871
|
...timeFormat ? { timeFormat } : {},
|
|
3024
4872
|
...slots ? { slots } : {}
|
|
3025
4873
|
};
|
|
@@ -3090,12 +4938,14 @@ function ConversationView({
|
|
|
3090
4938
|
if (el) el.scrollTop = el.scrollHeight;
|
|
3091
4939
|
}, [streamedChars, atBottom]);
|
|
3092
4940
|
const lastMarkedReadRef = react.useRef(null);
|
|
4941
|
+
const [markerReadyFor, setMarkerReadyFor] = react.useState(null);
|
|
3093
4942
|
react.useEffect(() => {
|
|
3094
4943
|
if (!atBottom) return;
|
|
3095
4944
|
if (messages.length === 0) return;
|
|
3096
4945
|
const tail = messages[messages.length - 1];
|
|
3097
4946
|
if (!tail) return;
|
|
3098
4947
|
if (tail.sequence === Number.MAX_SAFE_INTEGER) return;
|
|
4948
|
+
if (membersOn && markerReadyFor !== conversationId) return;
|
|
3099
4949
|
if (lastMarkedReadRef.current === tail.id) return;
|
|
3100
4950
|
lastMarkedReadRef.current = tail.id;
|
|
3101
4951
|
void markReadUpTo(tail.id).then(() => {
|
|
@@ -3103,7 +4953,33 @@ function ConversationView({
|
|
|
3103
4953
|
}).catch(() => {
|
|
3104
4954
|
lastMarkedReadRef.current = null;
|
|
3105
4955
|
});
|
|
3106
|
-
}, [atBottom, messages, markReadUpTo, onMarkedRead, conversationId]);
|
|
4956
|
+
}, [atBottom, messages, markReadUpTo, onMarkedRead, conversationId, membersOn, markerReadyFor]);
|
|
4957
|
+
const [unreadMarker, setUnreadMarker] = react.useState(null);
|
|
4958
|
+
const markerTakenRef = react.useRef(null);
|
|
4959
|
+
react.useEffect(() => {
|
|
4960
|
+
setUnreadMarker(null);
|
|
4961
|
+
markerTakenRef.current = null;
|
|
4962
|
+
}, [conversationId]);
|
|
4963
|
+
react.useEffect(() => {
|
|
4964
|
+
if (markerTakenRef.current === conversationId) return;
|
|
4965
|
+
if (!membersOn || loading || membersLoading) return;
|
|
4966
|
+
if (members.some((m) => m.conversation_id !== conversationId)) return;
|
|
4967
|
+
if (!me && members.length > 0) return;
|
|
4968
|
+
markerTakenRef.current = conversationId;
|
|
4969
|
+
setMarkerReadyFor(conversationId);
|
|
4970
|
+
const mine = me ? members.find((m) => m.user_id === me.id) : void 0;
|
|
4971
|
+
if (!mine) return;
|
|
4972
|
+
let after = mine.last_read_sequence ?? null;
|
|
4973
|
+
if (after === null && mine.last_read_message_id) {
|
|
4974
|
+
after = messages.find((m) => m.id === mine.last_read_message_id)?.sequence ?? null;
|
|
4975
|
+
if (after === null) return;
|
|
4976
|
+
}
|
|
4977
|
+
setUnreadMarker({
|
|
4978
|
+
conversationId,
|
|
4979
|
+
afterSequence: after ?? 0,
|
|
4980
|
+
lastReadId: mine.last_read_message_id
|
|
4981
|
+
});
|
|
4982
|
+
}, [conversationId, membersOn, loading, membersLoading, me, members, messages]);
|
|
3107
4983
|
const scrollToBottom = () => {
|
|
3108
4984
|
const el = listRef.current;
|
|
3109
4985
|
if (el) el.scrollTop = el.scrollHeight;
|
|
@@ -3114,6 +4990,74 @@ function ConversationView({
|
|
|
3114
4990
|
() => messages.filter((m) => react$1.isMessageVisibleTo(m, meIdForFeed)),
|
|
3115
4991
|
[messages, meIdForFeed]
|
|
3116
4992
|
);
|
|
4993
|
+
const marker = unreadMarker && unreadMarker.conversationId === conversationId ? unreadMarker : null;
|
|
4994
|
+
const unread = react.useMemo(() => {
|
|
4995
|
+
if (!marker) return { firstId: null, reaches: true, any: false };
|
|
4996
|
+
const isUnread = (m) => m.sequence > marker.afterSequence && m.sequence !== Number.MAX_SAFE_INTEGER && m.sender_id !== meIdForFeed;
|
|
4997
|
+
const reaches = !hasMore || visibleMessages.some((m) => m.sequence <= marker.afterSequence);
|
|
4998
|
+
const first = visibleMessages.find(isUnread) ?? null;
|
|
4999
|
+
return {
|
|
5000
|
+
firstId: reaches ? first?.id ?? null : null,
|
|
5001
|
+
reaches,
|
|
5002
|
+
any: first !== null
|
|
5003
|
+
};
|
|
5004
|
+
}, [marker, visibleMessages, hasMore, meIdForFeed]);
|
|
5005
|
+
const dividerRef = react.useRef(null);
|
|
5006
|
+
const [dividerInView, setDividerInView] = react.useState(false);
|
|
5007
|
+
const [jumpDismissed, setJumpDismissed] = react.useState(false);
|
|
5008
|
+
react.useEffect(() => {
|
|
5009
|
+
setJumpDismissed(false);
|
|
5010
|
+
}, [conversationId, marker?.afterSequence]);
|
|
5011
|
+
react.useEffect(() => {
|
|
5012
|
+
setDividerInView(false);
|
|
5013
|
+
const el = dividerRef.current;
|
|
5014
|
+
const root = listRef.current;
|
|
5015
|
+
if (!el || !root || typeof IntersectionObserver === "undefined") return;
|
|
5016
|
+
const io = new IntersectionObserver(([entry]) => setDividerInView(!!entry?.isIntersecting), {
|
|
5017
|
+
root,
|
|
5018
|
+
threshold: 0
|
|
5019
|
+
});
|
|
5020
|
+
io.observe(el);
|
|
5021
|
+
return () => io.disconnect();
|
|
5022
|
+
}, [unread.firstId]);
|
|
5023
|
+
const [jump, setJump] = react.useState(null);
|
|
5024
|
+
const jumpToFirstUnread = () => {
|
|
5025
|
+
if (!marker) return;
|
|
5026
|
+
if (unread.firstId) {
|
|
5027
|
+
scrollDividerIntoView(dividerRef.current);
|
|
5028
|
+
return;
|
|
5029
|
+
}
|
|
5030
|
+
setJump("loading");
|
|
5031
|
+
void loadUntil(marker.lastReadId ?? NO_MESSAGE).catch(() => false).then(() => {
|
|
5032
|
+
if (conversationIdRef.current === marker.conversationId) {
|
|
5033
|
+
setJump((j) => j ? "loaded" : j);
|
|
5034
|
+
}
|
|
5035
|
+
});
|
|
5036
|
+
};
|
|
5037
|
+
react.useEffect(() => {
|
|
5038
|
+
if (!jump) return;
|
|
5039
|
+
if (unread.firstId) {
|
|
5040
|
+
setJump(null);
|
|
5041
|
+
scrollDividerIntoView(dividerRef.current);
|
|
5042
|
+
} else if (jump === "loaded") {
|
|
5043
|
+
setJump(null);
|
|
5044
|
+
}
|
|
5045
|
+
}, [jump, unread.firstId]);
|
|
5046
|
+
react.useEffect(() => {
|
|
5047
|
+
setJump(null);
|
|
5048
|
+
}, [conversationId]);
|
|
5049
|
+
const showJump = !!marker && unread.any && !jumpDismissed && (!unread.firstId || !dividerInView);
|
|
5050
|
+
const markUnreadFrom = async (msg) => {
|
|
5051
|
+
const tail = messages[messages.length - 1];
|
|
5052
|
+
if (tail) lastMarkedReadRef.current = tail.id;
|
|
5053
|
+
try {
|
|
5054
|
+
await chat.conversations.one(conversationId).markUnread(msg.id);
|
|
5055
|
+
markerTakenRef.current = conversationId;
|
|
5056
|
+
setUnreadMarker({ conversationId, afterSequence: msg.sequence - 1, lastReadId: null });
|
|
5057
|
+
} catch {
|
|
5058
|
+
setSendNotice("Couldn't mark the message unread.");
|
|
5059
|
+
}
|
|
5060
|
+
};
|
|
3117
5061
|
const [pendingFocusId, setPendingFocusId] = react.useState(null);
|
|
3118
5062
|
const [focusMissing, setFocusMissing] = react.useState(false);
|
|
3119
5063
|
const onFocusNotFoundRef = react.useRef(onFocusMessageNotFound);
|
|
@@ -3182,12 +5126,68 @@ function ConversationView({
|
|
|
3182
5126
|
() => threadRootId ? messages.find((m) => m.id === threadRootId) ?? null : null,
|
|
3183
5127
|
[threadRootId, messages]
|
|
3184
5128
|
);
|
|
3185
|
-
const [replyingTo,
|
|
5129
|
+
const [replyingTo, setReplyingToState] = react.useState(null);
|
|
5130
|
+
const mentionComposer = mentions && members.length > 0;
|
|
3186
5131
|
react.useEffect(() => {
|
|
3187
|
-
|
|
5132
|
+
setReplyingToState(null);
|
|
3188
5133
|
setEditingId(null);
|
|
3189
5134
|
setThreadRootId(null);
|
|
5135
|
+
setSendNotice(null);
|
|
3190
5136
|
}, [conversationId]);
|
|
5137
|
+
const meIdForDrafts = me?.id ?? null;
|
|
5138
|
+
const draftsOn = persistDrafts && showComposer;
|
|
5139
|
+
const storage = draftStorage ?? localDraftStorage;
|
|
5140
|
+
const draftRef = react.useRef({ text: "", replyTo: null });
|
|
5141
|
+
const draftKeyFor = react.useCallback(
|
|
5142
|
+
() => draftsOn && meIdForDrafts ? draftKey(meIdForDrafts, conversationIdRef.current) : null,
|
|
5143
|
+
[draftsOn, meIdForDrafts]
|
|
5144
|
+
);
|
|
5145
|
+
const saveDraft = react.useCallback(
|
|
5146
|
+
(patch) => {
|
|
5147
|
+
draftRef.current = { ...draftRef.current, ...patch };
|
|
5148
|
+
const key = draftKeyFor();
|
|
5149
|
+
if (key) writeDraft(storage, key, draftRef.current);
|
|
5150
|
+
},
|
|
5151
|
+
[draftKeyFor, storage]
|
|
5152
|
+
);
|
|
5153
|
+
const setReplyingTo = react.useCallback(
|
|
5154
|
+
(m) => {
|
|
5155
|
+
setReplyingToState(m);
|
|
5156
|
+
saveDraft({ replyTo: m });
|
|
5157
|
+
},
|
|
5158
|
+
[saveDraft]
|
|
5159
|
+
);
|
|
5160
|
+
react.useEffect(() => {
|
|
5161
|
+
draftRef.current = { text: "", replyTo: null };
|
|
5162
|
+
const key = draftKeyFor();
|
|
5163
|
+
if (!key) return;
|
|
5164
|
+
let live = true;
|
|
5165
|
+
const apply = (d) => {
|
|
5166
|
+
if (!live || !d) return;
|
|
5167
|
+
const composer2 = composerRef.current;
|
|
5168
|
+
if (d.text && composer2 && composer2.getText() === "") composer2.setText(d.text);
|
|
5169
|
+
draftRef.current = { text: composer2?.getText() || d.text, replyTo: d.replyTo };
|
|
5170
|
+
if (d.replyTo && canQuote) setReplyingToState((cur) => cur ?? d.replyTo);
|
|
5171
|
+
};
|
|
5172
|
+
const found = readDraft(storage, key);
|
|
5173
|
+
if (found instanceof Promise) void found.then(apply);
|
|
5174
|
+
else apply(found);
|
|
5175
|
+
return () => {
|
|
5176
|
+
live = false;
|
|
5177
|
+
};
|
|
5178
|
+
}, [conversationId, draftKeyFor, storage, canQuote, mentionComposer]);
|
|
5179
|
+
const onComposerChange = react.useCallback((text) => saveDraft({ text }), [saveDraft]);
|
|
5180
|
+
react.useEffect(() => {
|
|
5181
|
+
if (!replyingTo) return;
|
|
5182
|
+
const current = messages.find((m) => m.id === replyingTo.id);
|
|
5183
|
+
if (current?.deleted_at) setReplyingTo(null);
|
|
5184
|
+
}, [messages, replyingTo, setReplyingTo]);
|
|
5185
|
+
const [sendNotice, setSendNotice] = react.useState(null);
|
|
5186
|
+
react.useEffect(() => {
|
|
5187
|
+
if (!sendNotice) return;
|
|
5188
|
+
const t = setTimeout(() => setSendNotice(null), 4e3);
|
|
5189
|
+
return () => clearTimeout(t);
|
|
5190
|
+
}, [sendNotice]);
|
|
3191
5191
|
const scrollToOriginal = (id) => {
|
|
3192
5192
|
const root = listRef.current;
|
|
3193
5193
|
if (!root) return;
|
|
@@ -3224,39 +5224,69 @@ function ConversationView({
|
|
|
3224
5224
|
const files = Array.from(e.dataTransfer?.files ?? []);
|
|
3225
5225
|
if (files.length > 0) composerRef.current?.addFiles(files);
|
|
3226
5226
|
};
|
|
3227
|
-
const
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
5227
|
+
const sendRequest = async (req) => {
|
|
5228
|
+
try {
|
|
5229
|
+
await send(req);
|
|
5230
|
+
} catch (err) {
|
|
5231
|
+
if (err instanceof react$1.ApiError && err.code === "quoted_message_deleted") {
|
|
5232
|
+
setReplyingTo(null);
|
|
5233
|
+
setSendNotice("The message you replied to was deleted.");
|
|
5234
|
+
const body = req.body;
|
|
5235
|
+
if (body) {
|
|
5236
|
+
setTimeout(() => {
|
|
5237
|
+
const composer2 = composerRef.current;
|
|
5238
|
+
if (composer2 && composer2.getText() === "") composer2.setText(body);
|
|
5239
|
+
}, 0);
|
|
5240
|
+
}
|
|
5241
|
+
return;
|
|
5242
|
+
}
|
|
5243
|
+
throw err;
|
|
5244
|
+
}
|
|
5245
|
+
setReplyingToState(null);
|
|
5246
|
+
setUnreadMarker(null);
|
|
5247
|
+
draftRef.current = { text: "", replyTo: null };
|
|
5248
|
+
const key = draftKeyFor();
|
|
5249
|
+
if (key) clearDraft(storage, key);
|
|
3234
5250
|
};
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3237
|
-
|
|
5251
|
+
const onSendBody = (body, opts) => sendRequest({
|
|
5252
|
+
body,
|
|
5253
|
+
...opts?.quoted_message_id ? { quoted_message_id: opts.quoted_message_id } : {},
|
|
5254
|
+
...opts?.attachment_ids && opts.attachment_ids.length > 0 ? { attachment_ids: opts.attachment_ids } : {}
|
|
5255
|
+
});
|
|
5256
|
+
const onSendWithMentions = (req) => sendRequest(req);
|
|
5257
|
+
const attachmentRules = {
|
|
5258
|
+
...maxFileSize !== void 0 ? { maxFileSize } : {},
|
|
5259
|
+
...acceptFileTypes ? { acceptFileTypes } : {}
|
|
3238
5260
|
};
|
|
3239
|
-
const Composer =
|
|
5261
|
+
const Composer = mentionComposer ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3240
5262
|
MentionInput,
|
|
3241
5263
|
{
|
|
3242
5264
|
ref: composerRef,
|
|
5265
|
+
onValueChange: onComposerChange,
|
|
3243
5266
|
conversationId,
|
|
3244
5267
|
onSend: onSendWithMentions,
|
|
3245
5268
|
onTyping: signalTyping,
|
|
3246
5269
|
attachments,
|
|
5270
|
+
emojiPicker,
|
|
5271
|
+
...attachmentRules,
|
|
3247
5272
|
...labelFor ? { labelFor } : {},
|
|
3248
5273
|
...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
|
|
3249
|
-
}
|
|
5274
|
+
},
|
|
5275
|
+
conversationId
|
|
3250
5276
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3251
5277
|
MessageComposer,
|
|
3252
5278
|
{
|
|
3253
5279
|
ref: composerRef,
|
|
5280
|
+
onValueChange: onComposerChange,
|
|
3254
5281
|
onSend: onSendBody,
|
|
3255
5282
|
onTyping: signalTyping,
|
|
3256
5283
|
attachments,
|
|
5284
|
+
emojiPicker,
|
|
5285
|
+
...attachmentRules,
|
|
3257
5286
|
...labelFor ? { labelFor } : {},
|
|
3258
5287
|
...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
|
|
3259
|
-
}
|
|
5288
|
+
},
|
|
5289
|
+
conversationId
|
|
3260
5290
|
);
|
|
3261
5291
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation-shell", children: [
|
|
3262
5292
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3297,6 +5327,14 @@ function ConversationView({
|
|
|
3297
5327
|
}
|
|
3298
5328
|
),
|
|
3299
5329
|
focusMissing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__status", role: "status", "aria-live": "polite", children: "That message isn't available." }),
|
|
5330
|
+
sendNotice && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5331
|
+
"div",
|
|
5332
|
+
{
|
|
5333
|
+
className: "poolse-conversation__status poolse-conversation__status--error",
|
|
5334
|
+
role: "alert",
|
|
5335
|
+
children: sendNotice
|
|
5336
|
+
}
|
|
5337
|
+
),
|
|
3300
5338
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3301
5339
|
"div",
|
|
3302
5340
|
{
|
|
@@ -3308,6 +5346,31 @@ function ConversationView({
|
|
|
3308
5346
|
"aria-relevant": "additions",
|
|
3309
5347
|
children: [
|
|
3310
5348
|
hasMore && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: topSentinelRef, "aria-hidden": "true", style: { height: 1 } }),
|
|
5349
|
+
showJump && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation__jump-unread", children: [
|
|
5350
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5351
|
+
"button",
|
|
5352
|
+
{
|
|
5353
|
+
type: "button",
|
|
5354
|
+
className: "poolse-conversation__jump-unread-btn",
|
|
5355
|
+
onClick: jumpToFirstUnread,
|
|
5356
|
+
disabled: jump !== null,
|
|
5357
|
+
children: [
|
|
5358
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "chevron-up", size: 14, label: null }),
|
|
5359
|
+
jump ? "Loading\u2026" : "Jump to first unread"
|
|
5360
|
+
]
|
|
5361
|
+
}
|
|
5362
|
+
),
|
|
5363
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5364
|
+
"button",
|
|
5365
|
+
{
|
|
5366
|
+
type: "button",
|
|
5367
|
+
className: "poolse-conversation__jump-unread-close",
|
|
5368
|
+
"aria-label": "Dismiss",
|
|
5369
|
+
onClick: () => setJumpDismissed(true),
|
|
5370
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 12, label: null })
|
|
5371
|
+
}
|
|
5372
|
+
)
|
|
5373
|
+
] }),
|
|
3311
5374
|
loading && messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__empty", children: "Loading\u2026" }) : messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__empty", children: emptyState ?? "No messages yet." }) : visibleMessages.map((msg, idx) => {
|
|
3312
5375
|
const prev = idx > 0 ? visibleMessages[idx - 1] ?? null : null;
|
|
3313
5376
|
const next = idx < visibleMessages.length - 1 ? visibleMessages[idx + 1] ?? null : null;
|
|
@@ -3365,22 +5428,37 @@ function ConversationView({
|
|
|
3365
5428
|
onDelete: () => void deleteMsg(msg.id),
|
|
3366
5429
|
onOpenThread: () => setThreadRootId(msg.id),
|
|
3367
5430
|
onQuote: () => setReplyingTo(msg),
|
|
5431
|
+
...!isSelf && msg.sequence !== Number.MAX_SAFE_INTEGER ? { onMarkUnread: () => void markUnreadFrom(msg) } : {},
|
|
3368
5432
|
onQuotedClick: scrollToOriginal,
|
|
3369
5433
|
...onCallBack ? { onCallBack } : {},
|
|
3370
5434
|
...layoutProps,
|
|
3371
5435
|
mentionsMe: mentionsViewer(msg, me?.id ?? null)
|
|
3372
5436
|
}
|
|
3373
5437
|
);
|
|
5438
|
+
const divider = unread.firstId === msg.id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5439
|
+
"div",
|
|
5440
|
+
{
|
|
5441
|
+
ref: dividerRef,
|
|
5442
|
+
className: "poolse-unread-divider",
|
|
5443
|
+
role: "separator",
|
|
5444
|
+
"aria-label": "New messages",
|
|
5445
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "New messages" })
|
|
5446
|
+
}
|
|
5447
|
+
) : null;
|
|
3374
5448
|
if (renderMessage) {
|
|
3375
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
5449
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
5450
|
+
divider,
|
|
5451
|
+
renderMessage(msg, me?.id ?? null, {
|
|
5452
|
+
layout,
|
|
5453
|
+
groupPosition,
|
|
5454
|
+
isRunStart: layout === "compact" || groupPosition === "first" || groupPosition === "standalone",
|
|
5455
|
+
renderDefault
|
|
5456
|
+
})
|
|
5457
|
+
] }, msg.id);
|
|
3381
5458
|
}
|
|
3382
5459
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
3383
5460
|
showDaySeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: react$1.formatDayLabel(msg.inserted_at) }) }),
|
|
5461
|
+
divider,
|
|
3384
5462
|
renderDefault()
|
|
3385
5463
|
] }, msg.id);
|
|
3386
5464
|
}),
|
|
@@ -3441,11 +5519,18 @@ function ConversationView({
|
|
|
3441
5519
|
rootMessage: threadRoot,
|
|
3442
5520
|
onClose: () => setThreadRootId(null),
|
|
3443
5521
|
layout,
|
|
3444
|
-
...timeFormat ? { timeFormat } : {}
|
|
5522
|
+
...timeFormat ? { timeFormat } : {},
|
|
5523
|
+
...attachmentRules
|
|
3445
5524
|
}
|
|
3446
5525
|
) })
|
|
3447
5526
|
] });
|
|
3448
5527
|
}
|
|
5528
|
+
var NO_MESSAGE = "00000000-0000-0000-0000-000000000000";
|
|
5529
|
+
function scrollDividerIntoView(el) {
|
|
5530
|
+
if (el && typeof el.scrollIntoView === "function") {
|
|
5531
|
+
el.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
3449
5534
|
function highlightRow(el) {
|
|
3450
5535
|
if (typeof el.scrollIntoView === "function") {
|
|
3451
5536
|
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -3492,23 +5577,34 @@ function ChatHeader({
|
|
|
3492
5577
|
onBack,
|
|
3493
5578
|
onPress,
|
|
3494
5579
|
onMembersPress,
|
|
3495
|
-
rightSlot
|
|
5580
|
+
rightSlot,
|
|
5581
|
+
showPresence = true
|
|
3496
5582
|
}) {
|
|
3497
5583
|
const { me } = react$1.useMe();
|
|
3498
5584
|
const meId = me?.id ?? null;
|
|
3499
5585
|
const { conversation: conv } = react$1.useConversation(conversationId);
|
|
3500
5586
|
const { members } = react$1.useMembers(conversationId);
|
|
3501
|
-
const { online } = react$1.usePresence(conversationId);
|
|
5587
|
+
const { online } = react$1.usePresence(showPresence ? conversationId : "");
|
|
3502
5588
|
const isDirect = conv?.type === "direct";
|
|
3503
5589
|
const otherMember = isDirect ? members.find((m) => m.user_id !== meId) : null;
|
|
3504
5590
|
const otherExtId = otherMember?.external_id ?? null;
|
|
3505
5591
|
const title = isDirect ? otherExtId ? labelFor?.(otherExtId) ?? otherExtId : conv?.name ?? "Direct chat" : conv?.name ?? "Untitled group";
|
|
3506
5592
|
const avatarUrl = isDirect && otherExtId ? avatarFor?.(otherExtId) ?? null : null;
|
|
3507
|
-
const
|
|
3508
|
-
const
|
|
5593
|
+
const presence = react$1.useUserPresence(showPresence && isDirect ? otherExtId : null);
|
|
5594
|
+
const now = useNow();
|
|
5595
|
+
const otherOnline = showPresence && isDirect && otherExtId ? !presence && online.has(otherExtId) : false;
|
|
5596
|
+
const subtitle = isDirect ? !showPresence ? null : presence ? presenceText(presence, now) : otherOnline ? "Online" : null : `${members.length} member${members.length === 1 ? "" : "s"}`;
|
|
3509
5597
|
const isPressable = typeof onPress === "function";
|
|
3510
5598
|
const titleContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3511
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5599
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5600
|
+
Avatar,
|
|
5601
|
+
{
|
|
5602
|
+
src: avatarUrl,
|
|
5603
|
+
name: title,
|
|
5604
|
+
presence: presence ?? (otherOnline ? "online" : null),
|
|
5605
|
+
size: "md"
|
|
5606
|
+
}
|
|
5607
|
+
),
|
|
3512
5608
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-chat-header__titles", children: [
|
|
3513
5609
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-chat-header__title", children: title }),
|
|
3514
5610
|
subtitle ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-chat-header__subtitle", children: subtitle }) : null
|
|
@@ -3551,7 +5647,15 @@ function ConversationList({
|
|
|
3551
5647
|
error: controlledError,
|
|
3552
5648
|
unreadCounts,
|
|
3553
5649
|
labelFor,
|
|
3554
|
-
avatarFor
|
|
5650
|
+
avatarFor,
|
|
5651
|
+
showPresence = true,
|
|
5652
|
+
density = "comfortable",
|
|
5653
|
+
sections,
|
|
5654
|
+
groupBy,
|
|
5655
|
+
header,
|
|
5656
|
+
hasMore: controlledHasMore,
|
|
5657
|
+
loadingMore: controlledLoadingMore,
|
|
5658
|
+
onLoadMore
|
|
3555
5659
|
}) {
|
|
3556
5660
|
const auto = react$1.useConversations();
|
|
3557
5661
|
const { me } = react$1.useMe();
|
|
@@ -3562,49 +5666,123 @@ function ConversationList({
|
|
|
3562
5666
|
const loading = isControlled ? controlledLoading ?? false : auto.loading;
|
|
3563
5667
|
const error = isControlled ? controlledError ?? null : auto.error;
|
|
3564
5668
|
const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
const
|
|
3576
|
-
const
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
);
|
|
3589
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3590
|
-
"li",
|
|
3591
|
-
{
|
|
3592
|
-
role: "option",
|
|
3593
|
-
"aria-selected": selected,
|
|
3594
|
-
className: `poolse-list__item${selected ? " poolse-list__item--selected" : ""}`,
|
|
3595
|
-
onClick: () => onSelect?.(conv),
|
|
3596
|
-
onKeyDown: (e) => {
|
|
3597
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
3598
|
-
e.preventDefault();
|
|
3599
|
-
onSelect?.(conv);
|
|
3600
|
-
}
|
|
3601
|
-
},
|
|
3602
|
-
tabIndex: 0,
|
|
3603
|
-
children: content
|
|
5669
|
+
const hasMore = isControlled ? controlledHasMore ?? false : auto.hasMore;
|
|
5670
|
+
const loadingMore = isControlled ? controlledLoadingMore ?? false : auto.loadingMore;
|
|
5671
|
+
const loadMore = isControlled ? onLoadMore : auto.loadMore;
|
|
5672
|
+
const listRef = react.useRef(null);
|
|
5673
|
+
const sentinelRef = react.useRef(null);
|
|
5674
|
+
const loadMoreRef = react.useRef(loadMore);
|
|
5675
|
+
loadMoreRef.current = loadMore;
|
|
5676
|
+
const busyRef = react.useRef(false);
|
|
5677
|
+
const hasRows = conversations.length > 0;
|
|
5678
|
+
react.useEffect(() => {
|
|
5679
|
+
const sentinel = sentinelRef.current;
|
|
5680
|
+
const root = listRef.current;
|
|
5681
|
+
if (!sentinel || !root || !hasMore || loadingMore) return;
|
|
5682
|
+
if (typeof IntersectionObserver === "undefined") return;
|
|
5683
|
+
const io = new IntersectionObserver(
|
|
5684
|
+
([entry]) => {
|
|
5685
|
+
if (!entry?.isIntersecting || busyRef.current) return;
|
|
5686
|
+
const fn = loadMoreRef.current;
|
|
5687
|
+
if (!fn) return;
|
|
5688
|
+
busyRef.current = true;
|
|
5689
|
+
void Promise.resolve().then(fn).catch(() => void 0).finally(() => {
|
|
5690
|
+
busyRef.current = false;
|
|
5691
|
+
});
|
|
3604
5692
|
},
|
|
3605
|
-
|
|
5693
|
+
{ root, rootMargin: "0px 0px 240px 0px", threshold: 0 }
|
|
3606
5694
|
);
|
|
3607
|
-
|
|
5695
|
+
io.observe(sentinel);
|
|
5696
|
+
return () => io.disconnect();
|
|
5697
|
+
}, [hasMore, loadingMore, hasRows]);
|
|
5698
|
+
const groups = react.useMemo(
|
|
5699
|
+
() => groupConversations(conversations, sections ?? (groupBy === "type" ? TYPE_SECTIONS : null)),
|
|
5700
|
+
[conversations, sections, groupBy]
|
|
5701
|
+
);
|
|
5702
|
+
const rootClass = [
|
|
5703
|
+
"poolse-conversation-list",
|
|
5704
|
+
`poolse-conversation-list--density-${density}`
|
|
5705
|
+
].join(" ");
|
|
5706
|
+
const body = (() => {
|
|
5707
|
+
if (loading && conversations.length === 0) {
|
|
5708
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading conversations\u2026" });
|
|
5709
|
+
}
|
|
5710
|
+
if (error && conversations.length === 0) {
|
|
5711
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder poolse-list--error", children: "Failed to load conversations." });
|
|
5712
|
+
}
|
|
5713
|
+
if (conversations.length === 0) {
|
|
5714
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: emptyState ?? "No conversations yet." });
|
|
5715
|
+
}
|
|
5716
|
+
const row = (conv) => {
|
|
5717
|
+
const selected = selectedId === conv.id;
|
|
5718
|
+
const unread = counts?.[conv.id] ?? 0;
|
|
5719
|
+
const content = renderItem ? renderItem(conv, selected) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5720
|
+
DefaultRow,
|
|
5721
|
+
{
|
|
5722
|
+
conv,
|
|
5723
|
+
selected,
|
|
5724
|
+
unread,
|
|
5725
|
+
meExternalId,
|
|
5726
|
+
meId,
|
|
5727
|
+
showPresence,
|
|
5728
|
+
compact: density === "compact",
|
|
5729
|
+
...labelFor ? { labelFor } : {},
|
|
5730
|
+
...avatarFor ? { avatarFor } : {}
|
|
5731
|
+
}
|
|
5732
|
+
);
|
|
5733
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5734
|
+
"li",
|
|
5735
|
+
{
|
|
5736
|
+
role: "option",
|
|
5737
|
+
"aria-selected": selected,
|
|
5738
|
+
className: `poolse-list__item${selected ? " poolse-list__item--selected" : ""}`,
|
|
5739
|
+
onClick: () => onSelect?.(conv),
|
|
5740
|
+
onKeyDown: (e) => {
|
|
5741
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
5742
|
+
e.preventDefault();
|
|
5743
|
+
onSelect?.(conv);
|
|
5744
|
+
}
|
|
5745
|
+
},
|
|
5746
|
+
tabIndex: 0,
|
|
5747
|
+
children: content
|
|
5748
|
+
},
|
|
5749
|
+
conv.id
|
|
5750
|
+
);
|
|
5751
|
+
};
|
|
5752
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("ul", { ref: listRef, className: "poolse-list", role: "listbox", "aria-label": "Conversations", children: [
|
|
5753
|
+
groups === null ? conversations.map(row) : groups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs("li", { role: "group", "aria-label": g.title, className: "poolse-list__section", children: [
|
|
5754
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list__section-title", "aria-hidden": "true", children: g.title }),
|
|
5755
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "poolse-list__section-items", role: "presentation", children: g.conversations.map(row) })
|
|
5756
|
+
] }, g.title)),
|
|
5757
|
+
loadingMore && /* @__PURE__ */ jsxRuntime.jsx("li", { className: "poolse-list__loading-more", role: "presentation", children: "Loading\u2026" }),
|
|
5758
|
+
hasMore && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5759
|
+
"li",
|
|
5760
|
+
{
|
|
5761
|
+
ref: sentinelRef,
|
|
5762
|
+
className: "poolse-list__sentinel",
|
|
5763
|
+
role: "presentation",
|
|
5764
|
+
"aria-hidden": "true"
|
|
5765
|
+
}
|
|
5766
|
+
)
|
|
5767
|
+
] });
|
|
5768
|
+
})();
|
|
5769
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: rootClass, children: [
|
|
5770
|
+
header !== void 0 && header !== null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation-list__header", children: header }) : null,
|
|
5771
|
+
body
|
|
5772
|
+
] });
|
|
5773
|
+
}
|
|
5774
|
+
var TYPE_SECTIONS = [
|
|
5775
|
+
{ title: "Channels", filter: (c) => c.type !== "direct" },
|
|
5776
|
+
{ title: "Direct messages", filter: (c) => c.type === "direct" }
|
|
5777
|
+
];
|
|
5778
|
+
function groupConversations(conversations, sections) {
|
|
5779
|
+
if (!sections || sections.length === 0) return null;
|
|
5780
|
+
const out = sections.map((s) => ({ title: s.title, conversations: [] }));
|
|
5781
|
+
for (const conv of conversations) {
|
|
5782
|
+
const i = sections.findIndex((s) => s.filter(conv));
|
|
5783
|
+
if (i !== -1) out[i].conversations.push(conv);
|
|
5784
|
+
}
|
|
5785
|
+
return out.filter((g) => g.conversations.length > 0);
|
|
3608
5786
|
}
|
|
3609
5787
|
function DefaultRow({
|
|
3610
5788
|
conv,
|
|
@@ -3612,6 +5790,8 @@ function DefaultRow({
|
|
|
3612
5790
|
unread,
|
|
3613
5791
|
meExternalId,
|
|
3614
5792
|
meId = null,
|
|
5793
|
+
showPresence,
|
|
5794
|
+
compact = false,
|
|
3615
5795
|
labelFor,
|
|
3616
5796
|
avatarFor
|
|
3617
5797
|
}) {
|
|
@@ -3623,13 +5803,21 @@ function DefaultRow({
|
|
|
3623
5803
|
const hasUnread = unread > 0;
|
|
3624
5804
|
const preview = react$1.formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (conv.last_sequence > 0 ? `${conv.last_sequence} message${conv.last_sequence === 1 ? "" : "s"}` : "No messages yet");
|
|
3625
5805
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3626
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5806
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5807
|
+
Avatar,
|
|
5808
|
+
{
|
|
5809
|
+
src: avatarUrl,
|
|
5810
|
+
name: title,
|
|
5811
|
+
size: compact ? "sm" : "md",
|
|
5812
|
+
...showPresence && otherExtId ? { presence: true, userId: otherExtId } : {}
|
|
5813
|
+
}
|
|
5814
|
+
),
|
|
3627
5815
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-list__body", children: [
|
|
3628
5816
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-list__head", children: [
|
|
3629
5817
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `poolse-list__title${hasUnread ? " poolse-list__title--unread" : ""}`, children: title }),
|
|
3630
5818
|
time && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-list__time", children: time })
|
|
3631
5819
|
] }),
|
|
3632
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list__preview", children: preview })
|
|
5820
|
+
compact ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list__preview", children: preview })
|
|
3633
5821
|
] }),
|
|
3634
5822
|
hasUnread && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3635
5823
|
"span",
|
|
@@ -3655,15 +5843,17 @@ function MemberList({
|
|
|
3655
5843
|
labelFor,
|
|
3656
5844
|
avatarFor,
|
|
3657
5845
|
onlineExternalIds,
|
|
5846
|
+
showPresence = true,
|
|
3658
5847
|
canRemove,
|
|
3659
5848
|
renderItem,
|
|
3660
5849
|
emptyState
|
|
3661
5850
|
}) {
|
|
3662
5851
|
const { members, loading, error, removeMember } = react$1.useMembers(conversationId);
|
|
3663
|
-
const
|
|
3664
|
-
|
|
5852
|
+
const legacy = onlineExternalIds !== void 0;
|
|
5853
|
+
const presences = react$1.usePresenceMany(
|
|
5854
|
+
showPresence && !legacy ? members.map((m) => m.external_id) : NO_IDS
|
|
3665
5855
|
);
|
|
3666
|
-
const
|
|
5856
|
+
const now = useNow();
|
|
3667
5857
|
if (loading && members.length === 0) {
|
|
3668
5858
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading members\u2026" });
|
|
3669
5859
|
}
|
|
@@ -3682,7 +5872,8 @@ function MemberList({
|
|
|
3682
5872
|
{
|
|
3683
5873
|
membership: m,
|
|
3684
5874
|
avatarUrl: avatarFor?.(m.external_id) ?? null,
|
|
3685
|
-
|
|
5875
|
+
presence: !showPresence ? null : legacy ? onlineExternalIds.has(m.external_id) : presences[m.external_id] ?? null,
|
|
5876
|
+
now,
|
|
3686
5877
|
removable: canRemove?.(m) ?? false,
|
|
3687
5878
|
onRemove: () => {
|
|
3688
5879
|
void removeMember(m.external_id);
|
|
@@ -3693,20 +5884,22 @@ function MemberList({
|
|
|
3693
5884
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "poolse-list__item", children: content }, m.id);
|
|
3694
5885
|
}) });
|
|
3695
5886
|
}
|
|
5887
|
+
var NO_IDS = [];
|
|
3696
5888
|
function DefaultMemberRow({
|
|
3697
5889
|
membership,
|
|
3698
5890
|
avatarUrl,
|
|
3699
|
-
|
|
5891
|
+
presence,
|
|
5892
|
+
now,
|
|
3700
5893
|
removable,
|
|
3701
5894
|
onRemove,
|
|
3702
5895
|
labelFor
|
|
3703
5896
|
}) {
|
|
3704
5897
|
const name = useDisplayName(membership.external_id, labelFor);
|
|
3705
5898
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-member-row", children: [
|
|
3706
|
-
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, online, size: "md" }),
|
|
5899
|
+
typeof presence === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, online: presence, size: "md" }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, presence, size: "md" }),
|
|
3707
5900
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-member-row__body", children: [
|
|
3708
5901
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__name", children: name }),
|
|
3709
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__sub", children:
|
|
5902
|
+
typeof presence === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__sub", children: presence ? "online" : "offline" }) : presence ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__sub", children: presenceText(presence, now) }) : null
|
|
3710
5903
|
] }),
|
|
3711
5904
|
/* @__PURE__ */ jsxRuntime.jsx(RoleBadge, { role: membership.role }),
|
|
3712
5905
|
removable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4543,7 +6736,10 @@ exports.ChatHeader = ChatHeader;
|
|
|
4543
6736
|
exports.ConversationList = ConversationList;
|
|
4544
6737
|
exports.ConversationView = ConversationView;
|
|
4545
6738
|
exports.EditableMessageBubble = EditableMessageBubble;
|
|
6739
|
+
exports.EditedLabel = EditedLabel;
|
|
6740
|
+
exports.EmojiPicker = EmojiPicker;
|
|
4546
6741
|
exports.GroupDetailsSheet = GroupDetailsSheet;
|
|
6742
|
+
exports.LinkPreviewCard = LinkPreviewCard;
|
|
4547
6743
|
exports.LiveCallBanner = LiveCallBanner;
|
|
4548
6744
|
exports.MemberList = MemberList;
|
|
4549
6745
|
exports.MentionInput = MentionInput;
|
|
@@ -4555,16 +6751,24 @@ exports.PoolseIcon = PoolseIcon;
|
|
|
4555
6751
|
exports.PoolseInbox = PoolseInbox;
|
|
4556
6752
|
exports.PoolseLogo = PoolseLogo;
|
|
4557
6753
|
exports.PoolseTheme = PoolseTheme;
|
|
6754
|
+
exports.PresenceBadge = PresenceBadge;
|
|
4558
6755
|
exports.ReactionPicker = ReactionPicker;
|
|
4559
6756
|
exports.ReactionStrip = ReactionStrip;
|
|
4560
6757
|
exports.RoomJoinBar = RoomJoinBar;
|
|
4561
6758
|
exports.RoomStage = RoomStage;
|
|
6759
|
+
exports.ThreadSummary = ThreadSummary;
|
|
4562
6760
|
exports.ThreadView = ThreadView;
|
|
4563
6761
|
exports.TypingIndicator = TypingIndicator;
|
|
4564
6762
|
exports.UploadQueueStrip = UploadQueueStrip;
|
|
4565
6763
|
exports.UserName = UserName;
|
|
4566
6764
|
exports.UserPickerSheet = UserPickerSheet;
|
|
6765
|
+
exports.formatRelativeTime = formatRelativeTime;
|
|
6766
|
+
exports.loadEmojiData = loadEmojiData;
|
|
6767
|
+
exports.localDraftStorage = localDraftStorage;
|
|
6768
|
+
exports.presenceStateLabel = presenceStateLabel;
|
|
6769
|
+
exports.presenceText = presenceText;
|
|
4567
6770
|
exports.useDisplayName = useDisplayName;
|
|
6771
|
+
exports.useEditHistory = useEditHistory;
|
|
4568
6772
|
exports.usePoolseFonts = usePoolseFonts;
|
|
4569
6773
|
exports.useSystemColorScheme = useSystemColorScheme;
|
|
4570
6774
|
exports.useTheme = useTheme;
|