@wtfalch/chat 0.1.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +293 -0
  3. package/dist/chat/admin/admin.css +78 -0
  4. package/dist/chat/admin/index.d.ts +92 -0
  5. package/dist/chat/admin/index.js +124 -0
  6. package/dist/chat/admin/react.d.ts +40 -0
  7. package/dist/chat/admin/react.js +169 -0
  8. package/dist/chat/chat.css +1003 -0
  9. package/dist/chat/client.d.ts +30 -0
  10. package/dist/chat/client.js +1300 -0
  11. package/dist/chat/exchange.d.ts +9 -0
  12. package/dist/chat/exchange.js +31 -0
  13. package/dist/chat/fake/index.d.ts +27 -0
  14. package/dist/chat/fake/index.js +48 -0
  15. package/dist/chat/fake/intercept.d.ts +21 -0
  16. package/dist/chat/fake/intercept.js +57 -0
  17. package/dist/chat/fake/sample.d.ts +4 -0
  18. package/dist/chat/fake/sample.js +6 -0
  19. package/dist/chat/fake/server.d.ts +168 -0
  20. package/dist/chat/fake/server.js +811 -0
  21. package/dist/chat/fake/xhr.d.ts +3 -0
  22. package/dist/chat/fake/xhr.js +104 -0
  23. package/dist/chat/index.d.ts +10 -0
  24. package/dist/chat/index.js +9 -0
  25. package/dist/chat/markdown.d.ts +29 -0
  26. package/dist/chat/markdown.js +161 -0
  27. package/dist/chat/react/Attachment.d.ts +39 -0
  28. package/dist/chat/react/Attachment.js +113 -0
  29. package/dist/chat/react/Chat.d.ts +48 -0
  30. package/dist/chat/react/Chat.js +139 -0
  31. package/dist/chat/react/Composer.d.ts +25 -0
  32. package/dist/chat/react/Composer.js +157 -0
  33. package/dist/chat/react/MessageRow.d.ts +21 -0
  34. package/dist/chat/react/MessageRow.js +114 -0
  35. package/dist/chat/react/NewDirectMessage.d.ts +23 -0
  36. package/dist/chat/react/NewDirectMessage.js +47 -0
  37. package/dist/chat/react/ThreadPanel.d.ts +25 -0
  38. package/dist/chat/react/ThreadPanel.js +17 -0
  39. package/dist/chat/react/Timeline.d.ts +27 -0
  40. package/dist/chat/react/Timeline.js +120 -0
  41. package/dist/chat/react/index.d.ts +7 -0
  42. package/dist/chat/react/index.js +6 -0
  43. package/dist/chat/react/mentions.d.ts +34 -0
  44. package/dist/chat/react/mentions.js +70 -0
  45. package/dist/chat/react/scroll.d.ts +26 -0
  46. package/dist/chat/react/scroll.js +27 -0
  47. package/dist/chat/react/timelineLayout.d.ts +26 -0
  48. package/dist/chat/react/timelineLayout.js +47 -0
  49. package/dist/chat/sanitize.d.ts +49 -0
  50. package/dist/chat/sanitize.js +264 -0
  51. package/dist/chat/store.d.ts +16 -0
  52. package/dist/chat/store.js +25 -0
  53. package/dist/chat/types.d.ts +340 -0
  54. package/dist/chat/types.js +1 -0
  55. package/package.json +88 -0
@@ -0,0 +1,1003 @@
1
+ /* `@wtfalch/chat/chat.css` -- the Chat section's own layout, in
2
+ the shape `@wtfalch/email`'s `mail.css` uses. Everything visual comes
3
+ from `@wtfalch/design`'s tokens; nothing here defines a colour, a radius
4
+ or a space of its own. Import it after the design stylesheet.
5
+
6
+ **Chat is a station on the agora's line map** (`apps/agora/DESIGN.md`), so it
7
+ speaks that world rather than inventing one:
8
+
9
+ - *The Inversion Rule.* The open channel fills solid ink with white text.
10
+ Nothing here renders "current" as a tint, a glow or a gradient.
11
+ - *The One Line Rule.* `--accent` is the company's own colour, and on the
12
+ map it draws exactly one stroke. No rule below reads it, so a channel
13
+ row, a separator and a status never compete with that line.
14
+ - *The Named Station Rule.* Every mark is paired with a word: the channel
15
+ icon with its name, the unread rule with "New messages", a failed send
16
+ with what to do about it.
17
+ - *The Flat Map Rule.* Panes are flat, separated by hairlines. The only
18
+ drawn motion is the unread rule arriving, which uses the same drafted
19
+ line-draw the rail does.
20
+
21
+ The rail's own signage measurements carry over: a station sign is 30px
22
+ tall with 2px corners, and its label is the label weight. */
23
+
24
+ .chat {
25
+ display: flex;
26
+ flex-direction: column;
27
+ height: 100%;
28
+ min-height: 0;
29
+ background: var(--bg);
30
+ color: var(--text);
31
+ font-size: var(--text-sm);
32
+ /* The surfaces a stylesheet does not draw still belong to the design.
33
+ The agora themes these globally; the package carries them too, scoped,
34
+ so Chat looks the same inside any host. */
35
+ caret-color: var(--text);
36
+ scrollbar-color: var(--border-strong) transparent;
37
+ }
38
+
39
+ .chat ::selection {
40
+ background: var(--text);
41
+ color: var(--panel);
42
+ }
43
+
44
+ .chat-bar {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: space-between;
48
+ gap: var(--space-3);
49
+ padding: var(--space-2) var(--space-3);
50
+ border-bottom: var(--border-width) solid var(--border);
51
+ background: var(--panel);
52
+ flex: none;
53
+ }
54
+
55
+ /* The section's own name, in the signage weight the rail's station labels
56
+ use -- Chat names itself the way every other place on the map does. */
57
+ .chat-wordmark {
58
+ font-size: var(--text-sm);
59
+ font-weight: var(--weight-strong);
60
+ letter-spacing: 0.01em;
61
+ white-space: nowrap;
62
+ }
63
+
64
+ .chat-bar-end {
65
+ display: flex;
66
+ align-items: center;
67
+ gap: var(--space-2);
68
+ min-width: 0;
69
+ }
70
+
71
+ .chat-panes {
72
+ display: flex;
73
+ flex: 1 1 auto;
74
+ min-height: 0;
75
+ /* See `@wtfalch/email`'s `.mail-panes`: a flex item's content otherwise
76
+ sets its minimum width, and a room name that does not wrap would push
77
+ the whole page wider than the window. */
78
+ min-width: 0;
79
+ }
80
+
81
+ .chat-panes > * {
82
+ min-width: 0;
83
+ }
84
+
85
+ /* ------------------------------------------------------------------ rooms */
86
+
87
+ .chat-rooms {
88
+ flex: none;
89
+ width: 16rem;
90
+ height: 100%;
91
+ padding: var(--space-2);
92
+ background: var(--panel);
93
+ border-right: var(--border-width) solid var(--border);
94
+ }
95
+
96
+ /* A run of stations is titled the way the map titles a phase: a word, in
97
+ the label weight, tracked open and small. The group's own action sits on
98
+ the same line, at the end of it. */
99
+ .chat-rooms-heading {
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: space-between;
103
+ gap: var(--space-2);
104
+ margin: var(--space-4) 0 var(--space-1);
105
+ padding: 0 var(--space-2);
106
+ color: var(--muted);
107
+ }
108
+
109
+ .chat-rooms-heading:first-child {
110
+ margin-top: 0;
111
+ }
112
+
113
+ .chat-rooms-heading-title {
114
+ margin: 0;
115
+ font-size: var(--text-2xs);
116
+ font-weight: var(--weight-strong);
117
+ letter-spacing: 0.04em;
118
+ text-transform: uppercase;
119
+ }
120
+
121
+ .chat-rooms-empty {
122
+ margin: 0;
123
+ padding: 0 var(--space-2);
124
+ color: var(--muted);
125
+ font-size: var(--text-xs);
126
+ }
127
+
128
+ .chat-room-list {
129
+ list-style: none;
130
+ margin: 0;
131
+ padding: 0;
132
+ }
133
+
134
+ /* A station sign: the rail's own 30px height and 2px corners, ink on
135
+ nothing at rest. The sign is the `<li>`, not the button inside it, so a
136
+ direct room's "Hide" sits *on* the sign and inverts with it rather than
137
+ beside it in a colour of its own. */
138
+ .chat-room-item {
139
+ display: flex;
140
+ align-items: center;
141
+ border-radius: var(--radius-sm);
142
+ background: transparent;
143
+ color: var(--text);
144
+ transition: background var(--dur-fast) var(--ease);
145
+ }
146
+
147
+ /* Hover is the enamel going one shade dim, not a tint of the text or of
148
+ the company's colour. */
149
+ .chat-room-item:hover {
150
+ background: var(--panel-2);
151
+ }
152
+
153
+ /* The Inversion Rule: the open channel is a lit station. */
154
+ .chat-room-item.on,
155
+ .chat-room-item.on:hover {
156
+ background: var(--text);
157
+ color: var(--panel);
158
+ }
159
+
160
+ .chat-room-row {
161
+ display: flex;
162
+ align-items: center;
163
+ gap: var(--space-2);
164
+ flex: 1 1 auto;
165
+ min-width: 0;
166
+ min-height: 30px;
167
+ padding: 0 var(--space-2);
168
+ border: none;
169
+ border-radius: var(--radius-sm);
170
+ background: transparent;
171
+ color: inherit;
172
+ font: inherit;
173
+ font-size: var(--text-sm);
174
+ font-weight: var(--weight-strong);
175
+ text-align: left;
176
+ cursor: pointer;
177
+ }
178
+
179
+ .chat-room-row:focus-visible,
180
+ .chat-room-hide:focus-visible {
181
+ outline: none;
182
+ box-shadow: var(--focus-ring);
183
+ }
184
+
185
+ /* A word at the end of the sign, quiet until it is wanted. Drawn in the
186
+ sign's own colour at reduced opacity rather than in `--muted`, so it
187
+ stays legible when the sign inverts to white on ink. */
188
+ .chat-room-hide {
189
+ flex: none;
190
+ padding: 0 var(--space-2);
191
+ border: none;
192
+ border-radius: var(--radius-sm);
193
+ background: transparent;
194
+ color: inherit;
195
+ opacity: 0.6;
196
+ font: inherit;
197
+ font-size: var(--text-2xs);
198
+ font-weight: var(--weight-strong);
199
+ letter-spacing: 0.04em;
200
+ text-transform: uppercase;
201
+ cursor: pointer;
202
+ transition: opacity var(--dur-fast) var(--ease);
203
+ }
204
+
205
+ .chat-room-hide:hover,
206
+ .chat-room-hide:focus-visible {
207
+ opacity: 1;
208
+ }
209
+
210
+ .chat-room-row.is-skeleton {
211
+ display: flex;
212
+ align-items: center;
213
+ gap: var(--space-2);
214
+ cursor: default;
215
+ }
216
+
217
+ .chat-room-icon {
218
+ display: inline-flex;
219
+ flex: none;
220
+ /* Inherited, so the mark inverts with its own sign rather than keeping a
221
+ colour of its own. */
222
+ color: inherit;
223
+ }
224
+
225
+ .chat-room-name {
226
+ flex: 1 1 auto;
227
+ min-width: 0;
228
+ overflow: hidden;
229
+ text-overflow: ellipsis;
230
+ white-space: nowrap;
231
+ }
232
+
233
+ /* ------------------------------------------------------------------- room */
234
+
235
+ /* An empty/loading/error state centres in the pane on its own; a selected
236
+ room's `.chat-room-pane` overrides both with `align-self`/`width` so it
237
+ fills the whole box edge to edge instead. */
238
+ .chat-room {
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ flex: 1 1 auto;
243
+ min-width: 0;
244
+ height: 100%;
245
+ padding: var(--space-6);
246
+ background: var(--bg);
247
+ }
248
+
249
+ /* The room and, beside it, whichever thread is open. A row, because a
250
+ thread is a place next to the room rather than on top of it -- the map
251
+ has no overlays outside the sheet and the board. */
252
+ .chat-room-pane {
253
+ display: flex;
254
+ align-self: stretch;
255
+ width: 100%;
256
+ height: 100%;
257
+ min-height: 0;
258
+ padding: 0;
259
+ }
260
+
261
+ .chat-room-main {
262
+ display: flex;
263
+ flex-direction: column;
264
+ flex: 1 1 auto;
265
+ min-width: 0;
266
+ min-height: 0;
267
+ }
268
+
269
+ /* --------------------------------------------------------------- thread */
270
+
271
+ .chat-thread {
272
+ display: flex;
273
+ flex-direction: column;
274
+ flex: none;
275
+ width: 22rem;
276
+ min-width: 0;
277
+ min-height: 0;
278
+ border-left: var(--border-width) solid var(--border);
279
+ background: var(--bg);
280
+ }
281
+
282
+ .chat-thread-bar {
283
+ display: flex;
284
+ align-items: center;
285
+ justify-content: space-between;
286
+ gap: var(--space-2);
287
+ flex: none;
288
+ padding: var(--space-2) var(--space-3);
289
+ border-bottom: var(--border-width) solid var(--border);
290
+ background: var(--panel);
291
+ }
292
+
293
+ /* Named, like every other place on the map. */
294
+ .chat-thread-heading {
295
+ font-size: var(--text-2xs);
296
+ font-weight: var(--weight-strong);
297
+ letter-spacing: 0.04em;
298
+ text-transform: uppercase;
299
+ color: var(--muted);
300
+ }
301
+
302
+ /* At a width that cannot hold both, a thread is a screen rather than a
303
+ panel: the room steps aside and "Back" is the way off it. The panel is
304
+ the same mounted component either way, so nothing is lost crossing the
305
+ breakpoint. */
306
+ @media (max-width: 860px) {
307
+ .chat-room-pane.has-thread .chat-room-main {
308
+ display: none;
309
+ }
310
+
311
+ .chat-thread {
312
+ flex: 1 1 auto;
313
+ width: auto;
314
+ border-left: none;
315
+ }
316
+ }
317
+
318
+ /* What a message says about the thread hanging off it: a count and the
319
+ people in it, both words, on one quiet line. */
320
+ .chat-thread-link {
321
+ display: flex;
322
+ align-items: baseline;
323
+ gap: var(--space-2);
324
+ margin: var(--space-1) 0 0;
325
+ padding: 0;
326
+ border: none;
327
+ border-radius: var(--radius-sm);
328
+ background: transparent;
329
+ color: var(--text);
330
+ font: inherit;
331
+ font-size: var(--text-2xs);
332
+ text-align: left;
333
+ cursor: pointer;
334
+ }
335
+
336
+ .chat-thread-count {
337
+ font-weight: var(--weight-strong);
338
+ font-variant-numeric: tabular-nums;
339
+ }
340
+
341
+ .chat-thread-people {
342
+ min-width: 0;
343
+ overflow: hidden;
344
+ text-overflow: ellipsis;
345
+ white-space: nowrap;
346
+ color: var(--muted);
347
+ }
348
+
349
+ .chat-thread-link:hover .chat-thread-count {
350
+ text-decoration: underline;
351
+ }
352
+
353
+ /* Starting a thread is an action, not information, so it stays out of the
354
+ way until the message is under a pointer or holds focus. A touch screen
355
+ has no hover to wait for, so there it is simply always drawn. */
356
+ .chat-message-reply {
357
+ margin: var(--space-1) 0 0;
358
+ padding: 0;
359
+ border: none;
360
+ background: transparent;
361
+ color: var(--muted);
362
+ font: inherit;
363
+ font-size: var(--text-2xs);
364
+ cursor: pointer;
365
+ opacity: 0;
366
+ transition: opacity var(--dur-fast) var(--ease);
367
+ }
368
+
369
+ .chat-message:hover .chat-message-reply,
370
+ .chat-message:focus-within .chat-message-reply {
371
+ opacity: 1;
372
+ }
373
+
374
+ @media (hover: none) {
375
+ .chat-message-reply {
376
+ opacity: 1;
377
+ }
378
+ }
379
+
380
+ .chat-thread-link:focus-visible,
381
+ .chat-message-reply:focus-visible {
382
+ outline: none;
383
+ box-shadow: var(--focus-ring);
384
+ }
385
+
386
+ /* The message somebody was sent here to find: ringed in ink, never filled
387
+ -- a filled message would read as the open station, and there is only one
388
+ of those. */
389
+ .chat-message.is-here {
390
+ padding: var(--space-1) var(--space-2);
391
+ border-radius: var(--radius-sm);
392
+ box-shadow: inset 0 0 0 var(--border-width) var(--text);
393
+ }
394
+
395
+ /* --------------------------------------------------- new direct message */
396
+
397
+ /* The agora's own `Board`: an enamel card under an ink name-plate, for a
398
+ state that is not a place you read. Flat but for the one hairline lift
399
+ the board carries on the map. */
400
+ .chat-board {
401
+ display: flex;
402
+ flex-direction: column;
403
+ width: 100%;
404
+ max-width: 26rem;
405
+ overflow: hidden;
406
+ border: var(--border-width) solid var(--border);
407
+ border-radius: var(--radius-md);
408
+ background: var(--panel);
409
+ box-shadow: var(--shadow-1);
410
+ }
411
+
412
+ /* The name-plate: white on ink, bleeding to the card's edges, the same
413
+ signage language as a lit station. */
414
+ .chat-board-title {
415
+ margin: 0;
416
+ padding: var(--space-3) var(--space-4);
417
+ background: var(--text);
418
+ color: var(--panel);
419
+ font-size: var(--text-md);
420
+ font-weight: var(--weight-strong);
421
+ letter-spacing: 0.01em;
422
+ }
423
+
424
+ .chat-board-body {
425
+ display: flex;
426
+ flex-direction: column;
427
+ gap: var(--space-3);
428
+ padding: var(--space-4);
429
+ }
430
+
431
+ .chat-people {
432
+ display: flex;
433
+ flex-direction: column;
434
+ gap: var(--space-2);
435
+ list-style: none;
436
+ margin: 0;
437
+ padding: 0;
438
+ max-height: 18rem;
439
+ overflow-y: auto;
440
+ }
441
+
442
+ /* Named and bounded, the way a failed send is: the signal colour rings the
443
+ line, it never fills it. */
444
+ .chat-board-error {
445
+ margin: 0;
446
+ padding: var(--space-2) var(--space-3);
447
+ border-radius: var(--radius-sm);
448
+ box-shadow: inset 0 0 0 var(--border-width) var(--bad);
449
+ color: var(--bad);
450
+ font-size: var(--text-xs);
451
+ }
452
+
453
+ .chat-board-actions {
454
+ display: flex;
455
+ align-items: center;
456
+ gap: var(--space-2);
457
+ }
458
+
459
+ /* --------------------------------------------------------------- timeline */
460
+
461
+ .chat-timeline {
462
+ flex: 1 1 auto;
463
+ min-height: 0;
464
+ padding: var(--space-3) var(--space-4);
465
+ }
466
+
467
+ /* A day is a drafted rule with its date sitting in the gap. */
468
+ .chat-divider {
469
+ display: flex;
470
+ align-items: center;
471
+ gap: var(--space-3);
472
+ margin: var(--space-5) 0 var(--space-2);
473
+ color: var(--muted);
474
+ font-size: var(--text-2xs);
475
+ font-weight: var(--weight-strong);
476
+ letter-spacing: 0.04em;
477
+ text-transform: uppercase;
478
+ font-variant-numeric: tabular-nums;
479
+ }
480
+
481
+ .chat-divider::before,
482
+ .chat-divider::after {
483
+ content: "";
484
+ flex: 1 1 auto;
485
+ height: var(--border-width);
486
+ background: var(--border);
487
+ }
488
+
489
+ /* Where the person left off: the same rule, drawn in ink so it reads as a
490
+ place rather than a decoration, and named in words. */
491
+ .chat-unread {
492
+ display: flex;
493
+ align-items: center;
494
+ gap: var(--space-3);
495
+ margin: var(--space-4) 0 var(--space-2);
496
+ color: var(--text);
497
+ font-size: var(--text-2xs);
498
+ font-weight: var(--weight-strong);
499
+ letter-spacing: 0.04em;
500
+ text-transform: uppercase;
501
+ }
502
+
503
+ .chat-unread::before,
504
+ .chat-unread::after {
505
+ content: "";
506
+ flex: 1 1 auto;
507
+ height: var(--border-width);
508
+ background: var(--text);
509
+ /* The one authored moment in this section: the rule draws itself in from
510
+ the person's own side, the way the rail draws a line. */
511
+ transform-origin: right center;
512
+ animation: chat-rule-draw var(--dur-slow) var(--ease-out);
513
+ }
514
+
515
+ .chat-unread::after {
516
+ transform-origin: left center;
517
+ }
518
+
519
+ @keyframes chat-rule-draw {
520
+ from {
521
+ transform: scaleX(0);
522
+ }
523
+ to {
524
+ transform: scaleX(1);
525
+ }
526
+ }
527
+
528
+ @media (prefers-reduced-motion: reduce) {
529
+ .chat-unread::before,
530
+ .chat-unread::after {
531
+ animation: none;
532
+ }
533
+ }
534
+
535
+ .chat-message {
536
+ padding: var(--space-1) 0;
537
+ }
538
+
539
+ .chat-message-meta {
540
+ display: flex;
541
+ align-items: baseline;
542
+ gap: var(--space-2);
543
+ }
544
+
545
+ .chat-message-sender {
546
+ font-weight: var(--weight-strong);
547
+ }
548
+
549
+ /* Times line up down the column, so a run of messages reads as a timetable
550
+ rather than ragged text. */
551
+ .chat-message-time {
552
+ color: var(--muted);
553
+ font-size: var(--text-2xs);
554
+ font-variant-numeric: tabular-nums;
555
+ }
556
+
557
+ .chat-message-body {
558
+ white-space: pre-wrap;
559
+ overflow-wrap: break-word;
560
+ }
561
+
562
+ .chat-message-body :is(p, ul, ol, blockquote, pre) {
563
+ margin: var(--space-1) 0;
564
+ }
565
+
566
+ .chat-message-body blockquote {
567
+ margin-inline: 0;
568
+ padding-left: var(--space-3);
569
+ border-left: var(--border-width) solid var(--border-strong);
570
+ color: var(--muted);
571
+ }
572
+
573
+ .chat-message-body pre {
574
+ overflow-x: auto;
575
+ padding: var(--space-2);
576
+ border: var(--border-width) solid var(--border);
577
+ border-radius: var(--radius-sm);
578
+ background: var(--panel-2);
579
+ }
580
+
581
+ .chat-message-body :is(code, pre) {
582
+ font-variant-numeric: tabular-nums;
583
+ }
584
+
585
+ .chat-message-body img {
586
+ max-width: 100%;
587
+ border-radius: var(--radius-sm);
588
+ }
589
+
590
+ /* A send in flight is the same message, held back; nothing moves and
591
+ nothing changes colour. */
592
+ .chat-message.is-pending .chat-message-body,
593
+ .chat-message.is-failed .chat-message-body {
594
+ opacity: 0.6;
595
+ }
596
+
597
+ .chat-message-status {
598
+ display: flex;
599
+ align-items: center;
600
+ gap: var(--space-2);
601
+ margin: var(--space-1) 0 0;
602
+ color: var(--muted);
603
+ font-size: var(--text-2xs);
604
+ }
605
+
606
+ /* A failure is named and bounded, the way the agora's error strip is: the
607
+ signal colour rings the row, it never fills it. */
608
+ .chat-message.is-failed {
609
+ padding: var(--space-1) var(--space-2);
610
+ border-radius: var(--radius-sm);
611
+ box-shadow: inset 0 0 0 var(--border-width) var(--bad);
612
+ }
613
+
614
+ .chat-message-status.is-failed {
615
+ color: var(--bad);
616
+ }
617
+
618
+ /* ------------------------------------------------------------- reactions */
619
+
620
+ .chat-reactions {
621
+ display: flex;
622
+ align-items: center;
623
+ flex-wrap: wrap;
624
+ gap: var(--space-1);
625
+ margin: var(--space-1) 0 0;
626
+ }
627
+
628
+ /* A reaction is a small sign: outline at rest, and solid ink once it is
629
+ yours -- the Inversion Rule, the same way the open station reads. No
630
+ tint, and nothing here touches the company's colour. */
631
+ .chat-reaction {
632
+ display: inline-flex;
633
+ align-items: center;
634
+ gap: var(--space-1);
635
+ padding: 0 var(--space-2);
636
+ min-height: 22px;
637
+ border: none;
638
+ border-radius: var(--radius-sm);
639
+ box-shadow: inset 0 0 0 var(--border-width) var(--border);
640
+ background: transparent;
641
+ color: var(--text);
642
+ font: inherit;
643
+ font-size: var(--text-2xs);
644
+ cursor: pointer;
645
+ transition: background var(--dur-fast) var(--ease);
646
+ }
647
+
648
+ .chat-reaction:hover {
649
+ background: var(--panel-2);
650
+ }
651
+
652
+ .chat-reaction.on,
653
+ .chat-reaction.on:hover {
654
+ box-shadow: none;
655
+ background: var(--text);
656
+ color: var(--panel);
657
+ }
658
+
659
+ .chat-reaction-count {
660
+ font-weight: var(--weight-strong);
661
+ font-variant-numeric: tabular-nums;
662
+ }
663
+
664
+ /* Adding one is a word, kept as quiet as "Reply in thread" and revealed on
665
+ the same terms. */
666
+ .chat-react {
667
+ padding: 0 var(--space-1);
668
+ border: none;
669
+ border-radius: var(--radius-sm);
670
+ background: transparent;
671
+ color: var(--muted);
672
+ font: inherit;
673
+ font-size: var(--text-2xs);
674
+ cursor: pointer;
675
+ opacity: 0;
676
+ transition: opacity var(--dur-fast) var(--ease);
677
+ }
678
+
679
+ .chat-message:hover .chat-react,
680
+ .chat-message:focus-within .chat-react,
681
+ .chat-react[aria-expanded="true"] {
682
+ opacity: 1;
683
+ }
684
+
685
+ @media (hover: none) {
686
+ .chat-react {
687
+ opacity: 1;
688
+ }
689
+ }
690
+
691
+ .chat-react-choices {
692
+ display: inline-flex;
693
+ align-items: center;
694
+ gap: var(--space-1);
695
+ padding: 0 var(--space-1);
696
+ border-radius: var(--radius-sm);
697
+ box-shadow: inset 0 0 0 var(--border-width) var(--border);
698
+ background: var(--panel);
699
+ }
700
+
701
+ .chat-react-choice {
702
+ padding: 0 var(--space-1);
703
+ min-height: 22px;
704
+ border: none;
705
+ border-radius: var(--radius-sm);
706
+ background: transparent;
707
+ font: inherit;
708
+ font-size: var(--text-xs);
709
+ cursor: pointer;
710
+ }
711
+
712
+ .chat-react-choice:hover {
713
+ background: var(--panel-2);
714
+ }
715
+
716
+ .chat-reaction:focus-visible,
717
+ .chat-react:focus-visible,
718
+ .chat-react-choice:focus-visible,
719
+ .chat-mention:focus-visible {
720
+ outline: none;
721
+ box-shadow: var(--focus-ring);
722
+ }
723
+
724
+ /* A message that names you: ruled down its own edge in ink, never filled
725
+ and never tinted. It has to read differently from the message somebody
726
+ was sent to find, which is ringed -- so this one is a single edge. */
727
+ .chat-message.is-mentioned {
728
+ padding-left: var(--space-3);
729
+ box-shadow: inset 2px 0 0 0 var(--text);
730
+ }
731
+
732
+ /* -------------------------------------------------------------- mentions */
733
+
734
+ /* Above the box, because the box sits at the foot of the room and a list
735
+ below it would be off the screen. */
736
+ .chat-mentions {
737
+ position: absolute;
738
+ bottom: 100%;
739
+ left: var(--space-4);
740
+ right: var(--space-4);
741
+ z-index: 1;
742
+ max-height: 14rem;
743
+ overflow-y: auto;
744
+ list-style: none;
745
+ margin: 0 0 var(--space-1);
746
+ padding: var(--space-1);
747
+ border: var(--border-width) solid var(--border);
748
+ border-radius: var(--radius-sm);
749
+ background: var(--panel);
750
+ box-shadow: var(--shadow-2);
751
+ }
752
+
753
+ .chat-mention {
754
+ display: flex;
755
+ align-items: baseline;
756
+ gap: var(--space-2);
757
+ width: 100%;
758
+ min-height: 30px;
759
+ padding: 0 var(--space-2);
760
+ border: none;
761
+ border-radius: var(--radius-sm);
762
+ background: transparent;
763
+ color: var(--text);
764
+ font: inherit;
765
+ font-size: var(--text-sm);
766
+ text-align: left;
767
+ cursor: pointer;
768
+ }
769
+
770
+ .chat-mention:hover {
771
+ background: var(--panel-2);
772
+ }
773
+
774
+ /* The Inversion Rule again: the one being offered is a lit station. */
775
+ .chat-mention.on,
776
+ .chat-mention.on:hover {
777
+ background: var(--text);
778
+ color: var(--panel);
779
+ }
780
+
781
+ .chat-mention-name {
782
+ font-weight: var(--weight-strong);
783
+ }
784
+
785
+ .chat-mention-id {
786
+ min-width: 0;
787
+ overflow: hidden;
788
+ text-overflow: ellipsis;
789
+ white-space: nowrap;
790
+ font-size: var(--text-2xs);
791
+ opacity: 0.7;
792
+ }
793
+
794
+ /* --------------------------------------------------------------- composer */
795
+
796
+ .chat-composer {
797
+ flex-wrap: wrap;
798
+ position: relative;
799
+ display: flex;
800
+ align-items: flex-end;
801
+ gap: var(--space-2);
802
+ flex: none;
803
+ padding: var(--space-3) var(--space-4);
804
+ border-top: var(--border-width) solid var(--border);
805
+ background: var(--panel);
806
+ }
807
+
808
+ .chat-composer-input {
809
+ flex: 1 1 12rem;
810
+ min-width: 0;
811
+ resize: none;
812
+ }
813
+
814
+ @media (max-width: 520px) {
815
+ .chat-rooms {
816
+ width: 12rem;
817
+ }
818
+
819
+ .chat-bar {
820
+ padding: var(--space-2);
821
+ }
822
+
823
+ .chat-timeline,
824
+ .chat-composer {
825
+ padding-inline: var(--space-3);
826
+ }
827
+ }
828
+
829
+ /* ------------------------------------------------------- edit and delete */
830
+
831
+ /* "edited" is a word beside the time, not a mark beside the text: the
832
+ Named Station Rule again, and it reads in the same muted, tabular line
833
+ the timestamp already occupies. */
834
+ .chat-message-edited {
835
+ color: var(--muted);
836
+ font-size: var(--text-2xs);
837
+ }
838
+
839
+ /* A deleted message is a gap that says what it was: the row keeps its
840
+ place so nothing moves under a reader, and the sentence is replaced by
841
+ the fact of its deletion, ruled off rather than filled. */
842
+ .chat-message-body.is-deleted {
843
+ padding-left: var(--space-2);
844
+ border-left: var(--border-width) solid var(--border-strong);
845
+ color: var(--muted);
846
+ font-style: italic;
847
+ }
848
+
849
+ /* The message being edited stays in the conversation, so the box is the
850
+ width of the message, not of a dialog. */
851
+ .chat-edit {
852
+ display: flex;
853
+ align-items: flex-end;
854
+ gap: var(--space-2);
855
+ margin: var(--space-1) 0;
856
+ }
857
+
858
+ .chat-edit-input {
859
+ flex: 1;
860
+ min-width: 0;
861
+ }
862
+
863
+ /* Asking before an irreversible thing is still just a row of words. */
864
+ .chat-confirm {
865
+ display: inline-flex;
866
+ align-items: center;
867
+ gap: var(--space-2);
868
+ }
869
+
870
+ .chat-confirm-question {
871
+ color: var(--muted);
872
+ font-size: var(--text-2xs);
873
+ }
874
+
875
+ /* The one that cannot be undone is named in the signal colour and ringed,
876
+ never filled -- the same way a failed send is bounded rather than
877
+ flooded. */
878
+ .chat-confirm-yes {
879
+ padding: 0 var(--space-2);
880
+ min-height: 22px;
881
+ border: none;
882
+ border-radius: var(--radius-sm);
883
+ box-shadow: inset 0 0 0 var(--border-width) var(--bad);
884
+ background: transparent;
885
+ color: var(--bad);
886
+ font: inherit;
887
+ font-size: var(--text-2xs);
888
+ font-weight: var(--weight-strong);
889
+ cursor: pointer;
890
+ }
891
+
892
+ .chat-confirm-yes:focus-visible {
893
+ outline: none;
894
+ box-shadow: var(--focus-ring);
895
+ }
896
+
897
+ /* ------------------------------------------------------------------ files */
898
+
899
+ /* A file is a named row, and a picture above it when this package can
900
+ show one. The name is never dropped for the picture: an image that does
901
+ not load, or that a reader cannot see, still has to say what it is. */
902
+ .chat-file {
903
+ margin: var(--space-1) 0 0;
904
+ }
905
+
906
+ .chat-file-image {
907
+ display: block;
908
+ max-width: min(100%, 24rem);
909
+ max-height: 20rem;
910
+ margin-bottom: var(--space-1);
911
+ border-radius: var(--radius-sm);
912
+ object-fit: contain;
913
+ }
914
+
915
+ .chat-file-row {
916
+ display: flex;
917
+ flex-wrap: wrap;
918
+ align-items: baseline;
919
+ gap: var(--space-2);
920
+ padding: var(--space-1) var(--space-2);
921
+ border-radius: var(--radius-sm);
922
+ box-shadow: inset 0 0 0 var(--border-width) var(--border);
923
+ }
924
+
925
+ .chat-file-name {
926
+ min-width: 0;
927
+ overflow: hidden;
928
+ text-overflow: ellipsis;
929
+ white-space: nowrap;
930
+ font-weight: var(--weight-strong);
931
+ }
932
+
933
+ .chat-file-size {
934
+ white-space: nowrap;
935
+ color: var(--muted);
936
+ font-size: var(--text-2xs);
937
+ font-variant-numeric: tabular-nums;
938
+ }
939
+
940
+ .chat-file-get {
941
+ margin-left: auto;
942
+ color: var(--text);
943
+ font-size: var(--text-2xs);
944
+ }
945
+
946
+ .chat-file-get:focus-visible {
947
+ outline: none;
948
+ box-shadow: var(--focus-ring);
949
+ }
950
+
951
+ /* Progress is a bar and a number, both drawn in ink: the count is the
952
+ part that survives a reader who cannot see the bar. */
953
+ .chat-file-progress {
954
+ display: flex;
955
+ align-items: center;
956
+ gap: var(--space-2);
957
+ margin: var(--space-1) 0 0;
958
+ color: var(--muted);
959
+ font-size: var(--text-2xs);
960
+ font-variant-numeric: tabular-nums;
961
+ }
962
+
963
+ .chat-file-progress progress {
964
+ appearance: none;
965
+ width: 8rem;
966
+ height: 3px;
967
+ border: none;
968
+ background: var(--border);
969
+ }
970
+
971
+ .chat-file-progress progress::-webkit-progress-bar {
972
+ background: var(--border);
973
+ }
974
+
975
+ .chat-file-progress progress::-webkit-progress-value {
976
+ background: var(--text);
977
+ }
978
+
979
+ .chat-file-progress progress::-moz-progress-bar {
980
+ background: var(--text);
981
+ }
982
+
983
+ /* A refusal is bounded by the signal colour, never filled by it -- the
984
+ same shape the failed-send row uses. */
985
+ .chat-composer-refused {
986
+ flex-basis: 100%;
987
+ margin: 0 0 var(--space-1);
988
+ padding: var(--space-1) var(--space-2);
989
+ border-radius: var(--radius-sm);
990
+ box-shadow: inset 0 0 0 var(--border-width) var(--bad);
991
+ color: var(--bad);
992
+ font-size: var(--text-2xs);
993
+ }
994
+
995
+ .chat-composer-file {
996
+ max-width: 9rem;
997
+ font-size: var(--text-2xs);
998
+ }
999
+
1000
+ .chat-composer-file:focus-visible {
1001
+ outline: none;
1002
+ box-shadow: var(--focus-ring);
1003
+ }